Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Do not exit in (uikit) postFinishLaunch but store the exit status and…
Browse files Browse the repository at this point in the history
… use that to return from main()

Also cleanup the stored argv in main() instead of postFinishLaunch.
  • Loading branch information
keestux committed Sep 27, 2011
1 parent 35ebf73 commit 898a298
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/video/uikit/SDL_uikitappdelegate.m
Expand Up @@ -36,6 +36,7 @@
extern int SDL_main(int argc, char *argv[]);
static int forward_argc;
static char **forward_argv;
static int exit_status;

int main(int argc, char **argv)
{
Expand All @@ -54,8 +55,14 @@ int main(int argc, char **argv)
/* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
UIApplicationMain(argc, argv, NULL, [SDLUIKitDelegate getAppDelegateClassName]);

/* free the memory we used to hold copies of argc and argv */
for (i = 0; i < forward_argc; i++) {
free(forward_argv[i]);
}
free(forward_argv);

[pool release];
return 0;
return exit_status;
}

static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue, const char *newValue)
Expand Down Expand Up @@ -95,17 +102,10 @@ - (void)postFinishLaunch
SDL_RegisterHintChangedCb(SDL_HINT_IDLE_TIMER_DISABLED, &SDL_IdleTimerDisabledChanged);

/* 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_status = SDL_main(forward_argc, forward_argv);

/* exit, passing the return status from the user's application */
exit(exit_status);
// exit(exit_status);
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Expand Down

0 comments on commit 898a298

Please sign in to comment.