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

Commit

Permalink
Fixed bug #847
Browse files Browse the repository at this point in the history
 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];
  • Loading branch information
slouken committed Nov 2, 2009
1 parent e2d96c4 commit 8d7facf
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/video/uikit/SDL_uikitappdelegate.m
Expand Up @@ -71,11 +71,8 @@ - (id)init {
return self;
}

- (void)applicationDidFinishLaunching:(UIApplication *)application {

/* Set working directory to resource path */
[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];

- (void)postFinishLaunch {

/* run the user's application, passing argc and argv */
int exit_status = SDL_main(forward_argc, forward_argv);

Expand All @@ -88,7 +85,15 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {

/* 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];
}

- (void)applicationWillTerminate:(UIApplication *)application {
Expand Down

0 comments on commit 8d7facf

Please sign in to comment.