Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in iOS setCenterWindow(window) on a window which is already in the center causes the app to crash (looks like bug was introduced in 1.2.0) #139

Closed
fahad86 opened this issue Jan 19, 2015 · 6 comments

Comments

@fahad86
Copy link
Contributor

fahad86 commented Jan 19, 2015

Tested with Titanium SDK 3.5.0

@fahad86
Copy link
Contributor Author

fahad86 commented Jan 19, 2015

A workaround would be to manually check if the current center window is the same as the one being set to and skip if same:
e.g.)

  if(SliderMenuWindow.centerWindow != myFirstPage){
    SliderMenuWindow.setCenterWindow(myFirstPage);  
  }     

@long
Copy link

long commented Jan 20, 2015

I ran into this issue 99% of the time when calling setCenterWindow(new_window). Not sure if that 1% was a fluke.

I tracked it down to the MMDrawerController submodule (MMDrawerController/MMDrawerController.m) where

if(oldCenterViewController){
    [oldCenterViewController willMoveToParentViewController:nil];
    if(animated == NO){
        [oldCenterViewController beginAppearanceTransition:NO animated:NO];
    }
    [oldCenterViewController removeFromParentViewController];
    [oldCenterViewController.view removeFromSuperview];
    if(animated == NO){
        [oldCenterViewController endAppearanceTransition];
    }
}

should have the removeFromSuperview called before removeFromParentViewController

if(oldCenterViewController){
    [oldCenterViewController willMoveToParentViewController:nil];
    if(animated == NO){
        [oldCenterViewController beginAppearanceTransition:NO animated:NO];
    }
    [oldCenterViewController.view removeFromSuperview];
    if(animated == NO){
        [oldCenterViewController endAppearanceTransition];
    }
    [oldCenterViewController removeFromParentViewController];
}

Rebuilding the NappDrawer iOS module without any additional changes now works without crashing my app.

@caspahouzer
Copy link

Then could you do a PR on MMDrawerController?

@long
Copy link

long commented Jan 20, 2015

In the process of setting up the PR on MMDrawerController

@long
Copy link

long commented Jan 20, 2015

Created the PR mutualmobile/MMDrawerController#324

@caspahouzer
Copy link

👍

@fahad86 fahad86 closed this as completed Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants