aryaxt / iOS-Slide-Menu

iOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
Other
1.53k stars 359 forks source link

Crash on push after poptoroot #172

Open madsodgaard opened 9 years ago

madsodgaard commented 9 years ago

I have a left menu, with a logout button, which goes back to the login screen.

On the login screen it performs a push segue to the next screen "SearchViewController"

Then when I press "Logout" and try to push another view it crashes with this:

SearchViewController respondsToSelector:]: message sent to deallocated instance 0x7ffbed05fb90

UIViewController *vc;

if(indexPath.section == 0) {
    switch (indexPath.row) {
        case 0: {
            if(superuser)
                vc = [storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
            else
                vc = [storyboard instantiateViewControllerWithIdentifier:@"myServersViewController"];
            break;
        }
        case 1: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"myServerViewController"];
            break;
        }
        case 2: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"ConsoleViewController"];
            break;
        }
        case 3: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"CommandsViewController"];
            break;
        }
        case 4: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"SchedulesViewController"];
            break;
        }
        case 5: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"BackupViewController"];
            break;
        }
    }
}
if(indexPath.section == 2) {
    if(indexPath.row == 0) {
        manager.currentServerID = -1;
        [manager.activeUserInformation removeAllObjects];

        [[SlideNavigationController sharedInstance] popToRootViewControllerAnimated:YES];
    }
}

[[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc withSlideOutAnimation:YES andCompletion:nil];