@@ -83,27 +83,30 @@ andWideArgumentValues: (wchar_t *[])wargv; #endif - (void)of_run; @end +const OFNotificationName OFApplicationDidFinishLaunchingNotification = + @"OFApplicationDidFinishLaunchingNotification"; const OFNotificationName OFApplicationWillTerminateNotification = @"OFApplicationWillTerminateNotification"; static OFApplication *app = nil; static void atexitHandler(void) { id delegate = app.delegate; - - [[OFNotificationCenter defaultCenter] - postNotificationName: OFApplicationWillTerminateNotification + OFNotification *notification = [OFNotification + notificationWithName: OFApplicationWillTerminateNotification object: app]; - if ([delegate respondsToSelector: @selector(applicationWillTerminate)]) - [delegate applicationWillTerminate]; + if ([delegate respondsToSelector: @selector(applicationWillTerminate:)]) + [delegate applicationWillTerminate: notification]; [delegate release]; + + [[OFNotificationCenter defaultCenter] postNotification: notification]; #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_SOCKETS) && \ defined(OF_AMIGAOS) && !defined(OF_MORPHOS) OFSocketDeinit(); #endif @@ -577,10 +580,11 @@ - (void)of_run { void *pool = objc_autoreleasePoolPush(); OFRunLoop *runLoop; + OFNotification *notification; #ifdef OF_HAVE_THREADS [OFThread of_createMainThread]; runLoop = [OFRunLoop currentRunLoop]; #else @@ -596,11 +600,19 @@ * of_setMainRunLoop: retained it. However, we only have a weak * reference to it now, whereas we had a strong reference before. */ pool = objc_autoreleasePoolPush(); - [_delegate applicationDidFinishLaunching]; + + notification = [OFNotification + notificationWithName: OFApplicationDidFinishLaunchingNotification + object: app]; + + [[OFNotificationCenter defaultCenter] postNotification: notification]; + + [_delegate applicationDidFinishLaunching: notification]; + objc_autoreleasePoolPop(pool); [runLoop run]; }