Changeset 154 for trunk


Ignore:
Timestamp:
Nov 13, 2006, 12:28:25 AM (19 years ago)
Author:
dmik
Message:

Kernel: Fixed recursion (that ate the entire stack) if the WShowModal flag was requested (or already set) when calling QWidget::reparent() and there was another modal widget visible.

Location:
trunk/src/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qapplication_pm.cpp

    r153 r154  
    20752075}
    20762076
     2077static inline bool isChildOf( QWidget * child, QWidget * parent )
     2078{
     2079    if ( !parent || !child )
     2080        return FALSE;
     2081    QWidget * w = child;
     2082    while( w && w != parent )
     2083        w = w->parentWidget();
     2084    return w != 0;
     2085}
     2086
    20772087Q_EXPORT void qt_enter_modal( QWidget *widget )
    20782088{
     
    20842094    if ( qt_modal_stack->containsRef( widget ) )
    20852095        return; // already modal
     2096
     2097    QWidget *m = qt_modal_stack->first();
     2098    while ( m ) {
     2099        if ( isChildOf( m, widget ) )
     2100            return; // child is already modal (prevent endless recursion)
     2101        m = qt_modal_stack->next();
     2102    }
    20862103
    20872104//@@TODO (dmik): Qt/Win32 sends WindowBlocked/WindowUnblocked events only
  • trunk/src/kernel/qwidget_pm.cpp

    r153 r154  
    11651165        if (
    11661166            topModal && this != topModal && parentWidget() != topModal &&
    1167             isTopLevel() && !testWFlags( WGroupLeader )
     1167            isTopLevel() && !testWFlags( WGroupLeader ) &&
     1168            !testWFlags( WShowModal ) // don't block if we're going to be modal
    11681169        )
    11691170            blockedBy = topModal;
Note: See TracChangeset for help on using the changeset viewer.