iOS send message to released object executing background methods
===

I have a screen with a UIWebView. In the viewdidload event I execute the following code:


    NSNumber *buttonPointer = [NSNumber numberWithInt:1 ];
    [self performSelectorInBackground: @selector(loadIntoWebView:) withObject:buttonPointer];


    // Executed in background to get the HTML from the server
    - (void)loadIntoWebView: (NSNumber *) pressedId
    {
        NSString *htmlString = [self getHtml:pressedId];
        [self performSelectorOnMainThread:@selector(loadingFinished:) withObject:htmlString waitUntilDone:FALSE];
    }


    // Callback when HTML is getted from the server. Must set the webview.
    - (void)loadingFinished: (NSString*) htmlString 
    {
        NSURL *baseURL = [NSURL URLWithString: HOST];
        [webView loadHTMLString:htmlString baseURL: baseURL];
        [webView setUserInteractionEnabled:YES];
    
    }


The problem with that screen is if I load the screen that has the webview and very fast (before giving time to complete the load of the html in the webview) I press the button to go to another screen it returns the error message sent to deallocated instance.

The way that I go to another screen is not very common, but I should not change it: 

    UINavigationController *navController = self.navigationController;
    // retain ourselves so that the controller will still exist once it's popped off
    [[self retain] autorelease];
    [navController popViewControllerAnimated:NO];
    UIViewController *newviewc = [[NewViewController alloc] initWithLesson:self.lesson];
    [navController pushViewController:newviewc animated:FALSE];
    [newviewc release];



If I wait so everything is loaded and after that I go to another screen, it works perfect. Can anyone help me? Instruments is detecting a Zombie.