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

UIKitView goes blank after app restart when using fast user switching #76

Open
raytrodd opened this issue Dec 7, 2011 · 2 comments
Open

Comments

@raytrodd
Copy link

raytrodd commented Dec 7, 2011

Users of my application have run into this bug while using fast user switching on mac osx lion. The specific issue occurs when a Chameleon app restarts while the owner is 'switched out' and another user is logged in. This may seem like an odd case, but this occurs when users of my application are "autoupdated" while their user account is 'switched out'.

I have a mac book pro running osx lion.

This is the simplest way to repro:
I have a mac book pro running osx lion.
1.) Login to your Mac as 'User A'
1.) Create a new user account 'User B', and ensure that 'fast user switching' is enabled.
2.) Build the BigApple example application, and copy it to ~/Applications
3.) run this command from the command line 'sleep 10 ; open ~/Applications/BigApple.app'. The sleep will give you enough time to execute the next step.
4.) quickly 'fast user switch' to 'User B'. This needs to be completed before the BigApple is launched.
5.) wait for 10 seconds until BigApple is running under 'User A'.
6.) fast user switch back to 'User A'

Expected:
You see BigApple running and the screen renders as normal

Actual:
You see a blank screen.

It appears the the UIKitView stops rendering all together. The application seems to be responsive and executing, but no UI is being drawn. I have seen a similar issue when the app is running and the machine switches to using the integrated graphics card from the descrete graphics card.

Any help would be appreciated. Perhaps there is a workaround I could employ in these cases to get the view hierarchy re-initialized.

@BigZaphod
Copy link
Owner

I would actually like to know a solution for this as well. We've had reports of oddities when fast user switching while Twitterrific is the active app. Upon return to the original user, the app is basically frozen or not rendering correctly. Something weird is going on.

On Dec 6, 2011, at 8:37 PM, raytrodd [email protected] wrote:

Users of my application have run into this bug while using fast user switching on mac osx lion. The specific issue occurs when a Chameleon app restarts while the owner is 'switched out' and another user is logged in. This may seem like an odd case, but this occurs when users of my application are "autoupdated" while their user account is 'switched out'.

I have a mac book pro running osx lion.

This is the simplest way to repro:
I have a mac book pro running osx lion.
1.) Login to your Mac as 'User A'
1.) Create a new user account 'User B', and ensure that 'fast user switching' is enabled.
2.) Build the BigApple example application, and copy it to ~/Applications
3.) run this command from the command line 'sleep 10 ; open ~/Applications/BigApple.app'. The sleep will give you enough time to execute the next step.
4.) quickly 'fast user switch' to 'User B'. This needs to be completed before the BigApple is launched.
5.) wait for 10 seconds until BigApple is running under 'User A'.
6.) fast user switch back to 'User A'

Expected:
You see BigApple running and the screen renders as normal

Actual:
You see a blank screen.

It appears the the UIKitView stops rendering all together. The application seems to be responsive and executing, but no UI is being drawn. I have seen a similar issue when the app is running and the machine switches to using the integrated graphics card from the descrete graphics card.

Any help would be appreciated. Perhaps there is a workaround I could employ in these cases to get the view hierarchy re-initialized.


Reply to this email directly or view it on GitHub:
#76

@raytrodd
Copy link
Author

raytrodd commented Dec 7, 2011

Yes, I have also run into the that issue as well. This also repros with the "BigApple" example app. Simply run big apple, switch to a different user, switch back. Clicking on the button now has no effect.

It appears that the events are still being fired, its just that nothing is actually getting rendered. For that specific issue, I found a fairly hacky workaround, which I am using in my application.

Listen for the NSWorkspaceSessionDidBecomeActiveNotification:

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
                                                         selector:@selector(switchHandler:)
                                                             name:NSWorkspaceSessionDidBecomeActiveNotification
                                                           object:nil];

In the switch handler, brutally force the view hierarchy to reload:

- (void)switchHandler:(NSNotification*) notification {
    [window setContentView:[window contentView]];
    [chameleonNSView performSelector:@selector(configureLayers)];
}

Unfortunately, this does not solve the issue when the application is actually restarted while switched out. These issues must be related in some way.

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

2 participants