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

Infinite loop when getting rmq.view_controller from a tab bar screen using the more tab. #275

Open
markrickert opened this issue Jun 21, 2015 · 0 comments

Comments

@markrickert
Copy link
Member

See demo repository here: https://github.com/markrickert/rmq.view_controller

Steps to reproduce:

  1. bundle
  2. rake
  3. Type into the REPL: rmq.view_controller.
  4. Switch to a new tab and try again.
  5. Switch to the "more" tab and try again. Notice it returns a UIMoreListController.
  6. Tap into a view controller in the more tab and try again.
  7. Crash.

Crashlog produces what looks like an infinite loop. Possible offending code here:

def current_view_controller(root_view_controller = nil)
if root_view_controller || ((window = RMQ.app.window) && (root_view_controller = window.rootViewController))
case root_view_controller
when UINavigationController
current_view_controller(root_view_controller.visibleViewController)
when UITabBarController
current_view_controller(root_view_controller.selectedViewController)
else
if root_view_controller.respond_to?(:visibleViewController)
current_view_controller(root_view_controller.visibleViewController)
elsif root_view_controller.respond_to?(:topViewController)
current_view_controller(root_view_controller.topViewController)
elsif root_view_controller.respond_to?(:frontViewController)
current_view_controller(root_view_controller.frontViewController)
elsif root_view_controller.respond_to?(:center) && (center = root_view_controller.center) && center.is_a?(UIViewController)
current_view_controller(root_view_controller.center)
elsif root_view_controller.respond_to?(:childViewControllers) && root_view_controller.childViewControllers.count > 0
current_view_controller(root_view_controller.childViewControllers.first)
else
root_view_controller
end
end
end
end

Note that it also crashes when you just type rmq into the REPL so it may be a more overarching problem.

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

1 participant