src/gui/widgets/qmenu.cpp
changeset 29 b72c6db6890b
parent 25 e24348a560a6
child 30 5dc02b23752f
equal deleted inserted replaced
25:e24348a560a6 29:b72c6db6890b
   990         caused = next_widget;
   990         caused = next_widget;
   991     }
   991     }
   992     return false;
   992     return false;
   993 }
   993 }
   994 
   994 
   995 class ExceptionGuard
       
   996 {
       
   997 public:
       
   998     inline ExceptionGuard(bool *w = 0) : watched(w) { Q_ASSERT(!(*watched)); *watched = true; }
       
   999     inline ~ExceptionGuard() { *watched = false; }
       
  1000     inline operator bool() { return *watched; }
       
  1001 private:
       
  1002     bool *watched;
       
  1003 };
       
  1004 
       
  1005 void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self)
   995 void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self)
  1006 {
   996 {
  1007     ExceptionGuard guard(&activationRecursionGuard);
   997     QBoolBlocker guard(activationRecursionGuard);
  1008 #ifdef QT3_SUPPORT
   998 #ifdef QT3_SUPPORT
  1009     const int actionId = q_func()->findIdForAction(action);
   999     const int actionId = q_func()->findIdForAction(action);
  1010 #endif
  1000 #endif
  1011     if(self)
  1001     if(self)
  1012         action->activate(action_e);
  1002         action->activate(action_e);