@@ -40,11 +40,15 @@ static OFApplication *app = nil; static void atexit_handler(void) { - [[app delegate] applicationWillTerminate]; + id delegate = [app delegate]; + + [delegate applicationWillTerminate]; + + [(id)delegate release]; } int of_application_main(int *argc, char **argv[], Class cls) { @@ -56,12 +60,10 @@ [app setDelegate: delegate]; [app run]; - [(id)delegate release]; - return 0; } @implementation OFApplication + sharedApplication