Showing posts with label control disposed. Show all posts
Showing posts with label control disposed. Show all posts

Thursday, September 8, 2016

Best Practice: Always check for Control disposed in Display.asyncExec()



Display.getDefault().asyncExec(new Runnable()
{
public void run()
{
//Always check for whether the control is disposed.
if (!progressComposite.isDisposed())
{
//perform UI operation.
}
}
});


Reason being, when we say asyncExec thread - it will execute on the next reasonable opportunity. But by that time the control would have been disposed.