Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Re: Display.isDisposed() & syncExec()

Hi,

I noticed that a call to Display.syncExec() or asyncExec() would throw
an SWTException if the Display object has been disposed. However, how
can I *reliably* tell if the object is disposed before calling
sync/asyncExec from a non-UI thread?

If I run the following code from a non-UI thread:

if (!display.isDisposed()) {
   // point A
   display.syncExec(...);
}

There may be chances that a UI thread which is running in parallel
with this non-UI thread disposes the display at point A.

Is there any technique to guarantee reliable determination, or did I
miss something here?

Thanks,
Weihan


Back to the top