I create one task named thread2 using AsyncTaskExecuter from a function which is running in some thread as mentioned below.
func1()
{
create task thread2
// call RunModalLoop on alert window //this blocks func1 till above thread2 completes
theDialog.setContentComponent (&theDialogPane, true, true);
theDialog.centreAroundComponent (NULL, theDialog.getWidth(), theDialog.getHeight());
theDialog.runModalLoop();
}
thread2func()
{
if (no error)
{
run task
}
call exitmodalstate on alertwindow to signal func1 about completion of thread2
}
Now here I have one issue, in case of some error, thread2func() reaches execution of line call exitmodalstate but func1() has not reached to line theDialog.runModalLoop();
So when calling exitmodalstate, it throws unhandled exception.
I also tried like this, but then it does not close dialog window and dialog keeps running
if(component.getParentComponent() != NULL)
{
component.getParentComponent()->exitModalState(10);
}
I get exception at below line "if (flags.currentlyModalFlag)" in exitmodalstate function
void Component::exitModalState (const int returnValue)
{
if (flags.currentlyModalFlag)
{
}
How to handle this exception