Re: User interface unresponsive in window
Re: User interface unresponsive in window
- Subject: Re: User interface unresponsive in window
- From: Uli Kusterer <email@hidden>
- Date: Fri, 17 Apr 2015 18:41:40 +0200
On 15 Apr 2015, at 16:04, Jonathan Taylor <email@hidden> wrote:
> I've started encountering intermittent problems in one specific window in my application, where text input boxes become unresponsive, steppers remain highlighted after clicking, etc. I'm rather short of ideas on how to debug this, particular since I haven't worked out how to reproduce it reliably. Other windows seem to remain unaffected.
>
> From dimly-remembered past experience I have a feeling it could be related to something somewhere resulting in GUI code being executed on a non-main thread. There is in principle a risk of that, since the window interacts with peripherals/drivers etc involving multithreaded code. I've tried to isolate the GUI code from the multithreaded code, but may perhaps have missed some obscure case. [ideally, I'd probably totally isolate anything multithreaded from ObjC code, but that would mean a proliferation of shadow classes, which is something I'd prefer to avoid being dragged into]
>
> Even if my suspicion about the cause (multithreading+GUI) is correct, I'm still not sure how to pin down and debug the problem, since there are so many entry points into GUI-related code (e.g. property value changes), not all of which even involve my own code directly. It would be great if there was some way of enabling a global "exception if main-thread requirements are violated", but I certainly haven't heard of such a thing (and can imagine there could be very good reasons why it would be prohibitively hard to implement). Can anyone suggest ways to diagnose and debug my problem (or indeed suggest other possible causes I haven't thought of)?
A few ideas:
- access of UI from non-main thread, corrupting data
- view inserted as subview of one of its superviews
- Someone calling one of the nextEventMatchingMask: methods and swallowing events that someone else is looking for to end a loop.
- Exception thrown from tracking code
- Someone calling display: from inside drawRect:, causing an endless recursion
Have you tried just pausing your app in the debugger when this happens and looking at each thread to see what is running?
Cheers,
-- Uli
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden