Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exception when closing QMainWindow (MFC CWinApp)
Forum Updated to NodeBB v4.3 + New Features

Exception when closing QMainWindow (MFC CWinApp)

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 241 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    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 :(

    1 Reply Last reply
    0
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #2

      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 :) :)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved