Hi, I have small problem which I'm not sure how to tackle the best...
I have put some classic save handling (Save/Don't Save/Cancel) to tryToQuitApplication();
bool tryToQuitApplication(){ if (contentComponent->canQuit()) return true; int result = AlertWindow::showYesNoCancelBox(AlertWindow::AlertIconType::QuestionIcon, L"Save?", L"Do you want to save changes?", L"Save", L"Don't save", L"Cancel"); switch (result) { case 0: return false; case 1: contentComponent->save(); return true; default: break; } //prompt to save return true; }
No I have a problem if user selects the option to save the project. The saving logic is implemented using threads (namely ThreadWithProgressWindow) because it takes some time. The problem is that the thread window is freed after threadComplete which is executed "next time" in the message thread. So I either need to somehow postpone the "application closing" or implement the whole thing again without the thread and use that just for the case of application exiting. What is the best way of implementing this?