Skip to content

Commit

Permalink
Fix warning message on Mac about secure coding not enabled
Browse files Browse the repository at this point in the history
- See #630

- On macOS 14 and later a warning message is written to console:
"WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES."

- This adds an NSApplicationDelegate that implements applicationSupportsSecureRestorableState
  • Loading branch information
Phillipus committed May 15, 2024
1 parent c4be7f2 commit d15cb06
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ static const char* jvmLibs[] = { "libjvm.dylib", "libjvm.jnilib", "libjvm.so", N
/* Define the window system arguments for the various Java VMs. */
static char* argVM_JAVA[] = { "-XstartOnFirstThread", NULL };

@interface AppDelegate : NSObject <NSApplicationDelegate>
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app;
@end

@implementation AppDelegate
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {
return YES;
}
@end

static NSWindow* window = nil;
@interface KeyWindow : NSWindow { }
- (BOOL)canBecomeKeyWindow;
Expand All @@ -106,7 +116,7 @@ static NSWindow* window = nil;

int result = ENOENT;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
[[NSApplication sharedApplication] setDelegate: [[AppDelegate alloc] init]];
NSImage* image = [[NSImage alloc] initByReferencingFile: featureImage];
[featureImage release];
if (image != NULL) {
Expand Down

0 comments on commit d15cb06

Please sign in to comment.