Ignore:
Timestamp:
Aug 4, 2010, 1:28:23 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Fixed a possible crash and an endless PM event loop recursion when re-parenting widgets in DIVE mode. This could be seen when dragging a toolbar out of the dock widget, dragging it back then closing the application (crash) or attempting to drag the toolbar out again (endless recursion).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qwidget_pm.cpp

    r749 r775  
    13891389            qApp->d_func()->closePopup(this);
    13901390        if (destroyWindow && !(windowType() == Qt::Desktop) &&
    1391             internalWinId() != NULLHANDLE) {
    1392             HWND id = internalWinId();
    1393             if (isWindow() && !(windowType() == Qt::Popup)) {
    1394                 // extra data including extra->topextra has been already
    1395                 // deleted at this point by deleteExtra() and therefore
    1396                 // calling frameWinId() is useless -- it will return the
    1397                 // client window handle. Use WinQueryWindow() instead.
    1398                 id = WinQueryWindow(id, QW_PARENT);
    1399                 Q_ASSERT(id != NULLHANDLE);
    1400             }
     1391            d->frameWinId() != NULLHANDLE) {
     1392            // make sure the backing store is deleted before destroying HWND --
     1393            // QPMDiveWindowSurface depends on that
     1394            delete d->topData()->backingStore;
     1395            d->topData()->backingStore = 0;
     1396            // now destroy HWND
     1397            HWND id = d->frameWinId();
    14011398#if defined(QT_DEBUGWINCREATEDESTROY)
    14021399            qDebug() << "|Destroying window" << this
     
    14721469    }
    14731470
    1474     if ((q->windowType() == Qt::Desktop))
    1475         old_fid = NULLHANDLE;
     1471    if (old_fid != NULLHANDLE && q->windowType() != Qt::Desktop) {
     1472        // make sure the backing store is deleted before destroying HWND --
     1473        // QPMDiveWindowSurface depends on that
     1474        if (extra && extra->topextra) {
     1475            delete extra->topextra->backingStore;
     1476            extra->topextra->backingStore = 0;
     1477            // zero the to-be-destroyed frame HWND just in case
     1478            extra->topextra->fId = NULLHANDLE;
     1479        }
     1480        // now destroy HWND
     1481        qt_WinDestroyWindow(old_fid);
     1482    }
     1483
    14761484    setWinId(0);
    14771485
     
    15061514        setWindowTitle_helper(extra->topextra->caption);
    15071515    }
    1508     if (old_fid != NULLHANDLE)
    1509         qt_WinDestroyWindow(old_fid);
    15101516
    15111517    if (q->testAttribute(Qt::WA_AcceptDrops) || dropSiteWasRegistered
Note: See TracChangeset for help on using the changeset viewer.