comparison src/video/uikit/SDL_uikitappdelegate.m @ 3422:ec4db979dddb

Fixed bug #847 Roger Willcocks 2009-10-25 08:45:37 PDT appDidFinishLaunching is triggered before all the setup's complete. The easiest fix is to arrange for another event to be sent when it's really ready, and run SDL_main from there. Ref. http://blog.rightsprite.com/2008/11/iphone-applicationdidfinishlaunching.html SDL-1.3.0-4563/src/video/uikit/SDL_uikitappdelegate.m: - (void)postFinishLaunch { /* run the user's application, passing argc and argv */ int exit_status = SDL_main(forward_argc, forward_argv); /* free the memory we used to hold copies of argc and argv */ int i; for (i=0; i<forward_argc; i++) { free(forward_argv[i]); } free(forward_argv); /* exit, passing the return status from the user's application */ exit(exit_status); } - (void)applicationDidFinishLaunching:(UIApplication *)application { /* Set working directory to resource path */ [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]]; [self performSelector:@selector(postFinishLaunch) withObject:nil afterDelay:0.0];
author Sam Lantinga <slouken@libsdl.org>
date Mon, 02 Nov 2009 07:55:42 +0000
parents 4ec48602f1db
children 64ce267332c6
comparison
equal deleted inserted replaced
3421:7bc83a9e09fd 3422:ec4db979dddb
69 window = nil; 69 window = nil;
70 windowID = 0; 70 windowID = 0;
71 return self; 71 return self;
72 } 72 }
73 73
74 - (void)applicationDidFinishLaunching:(UIApplication *)application { 74 - (void)postFinishLaunch {
75 75
76 /* Set working directory to resource path */
77 [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
78
79 /* run the user's application, passing argc and argv */ 76 /* run the user's application, passing argc and argv */
80 int exit_status = SDL_main(forward_argc, forward_argv); 77 int exit_status = SDL_main(forward_argc, forward_argv);
81 78
82 /* free the memory we used to hold copies of argc and argv */ 79 /* free the memory we used to hold copies of argc and argv */
83 int i; 80 int i;
86 } 83 }
87 free(forward_argv); 84 free(forward_argv);
88 85
89 /* exit, passing the return status from the user's application */ 86 /* exit, passing the return status from the user's application */
90 exit(exit_status); 87 exit(exit_status);
91 88 }
89
90 - (void)applicationDidFinishLaunching:(UIApplication *)application {
91
92 /* Set working directory to resource path */
93 [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
94
95 [self performSelector:@selector(postFinishLaunch) withObject:nil
96 afterDelay:0.0];
92 } 97 }
93 98
94 - (void)applicationWillTerminate:(UIApplication *)application { 99 - (void)applicationWillTerminate:(UIApplication *)application {
95 100
96 SDL_SendQuit(); 101 SDL_SendQuit();