Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -29,11 +29,12 @@ #define OF_APPLICATION_DELEGATE(cls) \ int \ main(int argc, char *argv[]) \ { \ - return of_application_main(&argc, &argv, [cls class]); \ + return of_application_main(&argc, &argv, \ + (cls *)[[cls alloc] init]); \ } #ifdef OF_HAVE_PLEDGE # define OF_HAVE_SANDBOX #endif @@ -255,11 +256,11 @@ #ifdef __cplusplus extern "C" { #endif extern int of_application_main(int *_Nonnull, - char *_Nonnull *_Nonnull[_Nonnull], Class); + char *_Nonnull *_Nonnull[_Nonnull], id ); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -113,27 +113,20 @@ SIGNAL_HANDLER(SIGUSR2) #endif #undef SIGNAL_HANDLER int -of_application_main(int *argc, char **argv[], Class cls) +of_application_main(int *argc, char **argv[], + id delegate) { - id delegate; #ifdef OF_WINDOWS wchar_t **wargv, **wenvp; int wargc, si = 0; #endif [[OFLocalization alloc] init]; - if (![cls conformsToProtocol: @protocol(OFApplicationDelegate)]) { - fprintf(stderr, "FATAL ERROR:\n Class %s does not conform to " - "protocol OFApplicationDelegate,\n but was specified via " - "OF_APPLICATION_DELEGATE()!\n", class_getName(cls)); - exit(1); - } - app = [[OFApplication alloc] of_init]; [app of_setArgumentCount: argc andArgumentValues: argv]; @@ -141,11 +134,10 @@ __wgetmainargs(&wargc, &wargv, &wenvp, _CRT_glob, &si); [app of_setArgumentCount: wargc andWideArgumentValues: wargv]; #endif - delegate = [[cls alloc] init]; [app setDelegate: delegate]; [app of_run]; [delegate release]; Index: tests/TestsAppDelegate.m ================================================================== --- tests/TestsAppDelegate.m +++ tests/TestsAppDelegate.m @@ -146,11 +146,11 @@ #if defined(OF_WII) || defined(OF_PSP) || defined(OF_NINTENDO_DS) || \ defined(OF_NINTENDO_3DS) @try { return of_application_main(&argc, &argv, - [TestsAppDelegate class]); + [[TestsAppDelegate alloc] init]); } @catch (id e) { TestsAppDelegate *delegate = [[OFApplication sharedApplication] delegate]; OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; @@ -198,11 +198,12 @@ # else abort(); # endif } #else - return of_application_main(&argc, &argv, [TestsAppDelegate class]); + return of_application_main(&argc, &argv, + [[TestsAppDelegate alloc] init]); #endif } @implementation TestsAppDelegate - (void)outputString: (OFString *)str