Re: runModalForWindow
Re: runModalForWindow
- Subject: Re: runModalForWindow
- From: John Stiles <email@hidden>
- Date: Thu, 27 Oct 2005 14:01:10 -0700
FWIW, I didn't ever get any responses on this, so I wrote up a test
app that demonstrated the problem. There's pretty clearly an issue
with performSelectorOnMainThread here; regular
performSelector:withObject:afterDelay: did not reproduce the bug (my
selector did not fire until after I stopped resizing the window).
It's now filed as rdar://4319016.
On Oct 25, 2005, at 10:05 PM, John Stiles wrote:
I wrote some code today and found a bug, but I'm not sure if the
bug was mine or Apple's. I already found another (cleaner) way to
do what I wanted to do, so I don't need ideas for alternate
implementations, but I'm trying to decide whether I should file a
radar or not. Here's the scoop:
- I have a NSWindow visible with a WebView, NSTextField, a progress
bar, and buttons; the user can interact with it.
- I have a second thread running which is doing work and
occasionally calling performSelectorOnMainThread to update the
progress bar and text fields.
- In some situations, my performSelectorOnMainThread selector was
deciding that we temporarily needed to go modal, and calling
NSApp's -runModalForWindow: on my window.
The problem here was that, if the user is in the middle of resizing
the window at the point when the performSelectorOnMainThread
selector decided to call -runModalForWindow:, the window got into a
really funky state. It pretty much froze up and wouldn't respond to
clicks. Other updates that my main-thread selector had sent to the
window during the resize operation, such as updating the progress
bar or changing text in an NSTextField, also seemed to fall through
the cracks entirely. (Normally, they all seemed to get applied as
soon as the resize operation completed.) I found that I could
sometimes "unstick" the window by focusing another application and
then refocusing on my app; at this point the maximize button of my
window would become responsive, and once I maximized the window, it
sprung back to life and all the pending updates, like progress bar
updates and NSTextField content changes, got applied all at once.
This really sounds like a bug in -runModalForWindow: to me, but I
know that my usage is unorthodox--typically, you make a window
modal when it's first becoming visible, before the user has had a
chance to start interacting with it. (In the final version, FWIW, I
managed to avoid going modal at all.) So is this a Cocoa bug, or is
it my fault for abusing the system?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden