Exception when closing QMainWindow (MFC CWinApp)
-
This is happening as the QMainWindow instance is being destroyed
The error is happening at wincore.cpp line 1078 which reads:
ASSERT(pMap->LookupPermanent(hWndOrig) == NULL);
I tried adding a PostNcDestroy to the CDialog that is part of the QMainWindow subclass:
void MyDialog::PostNcDestroy()
{CDialog::PostNcDestroy(); delete this;
}
but that didn't help :(
-
I managed to fix this issue. As the processingDlg CDialog isn't a child of a CFrameWindow (e.g.), it isn't automatically destroyed (WM_DESTROY) when the QMainWindow is closed.
I added a call to the QMainWIndow CloseEvent handler saying:
processingDlg.DestroyWindow();
and all is now well :) :)