From 09d78f2e4795679d173374fd7e8996ac5d8d523b Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 12 Jul 2007 09:22:07 +0000 Subject: [PATCH] *** empty log message *** --- src/Qtx/QtxPopupMgr.cxx | 16 ++++++++++++++++ src/Qtx/QtxPopupMgr.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index 3efd99ae1..e418300ff 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -290,6 +290,8 @@ void QtxPopupMgr::setSelection( QtxPopupSelection* sel ) if ( mySelection ) mySelection->setParent( this ); + connect( mySelection, SIGNAL( destroyed( QObject* ) ), + this, SLOT( onSelectionDestroyed( QObject* ) ) ); QtxActionMgr::triggerUpdate(); } @@ -625,6 +627,20 @@ QVariant QtxPopupMgr::parameter( const QString& name, const int idx ) const return val; } +/*! + \brief Called when selection is destroyed. + + Prevents crashes when the selection object is destroyed outside the + popup manager. + + \param o selection object being destroyed +*/ +void QtxPopupMgr::onSelectionDestroyed( QObject* o ) +{ + if ( o == mySelection ) + mySelection = 0; +} + /*! \class QtxPopupSelection \brief This class is a part of the popup menu management system. diff --git a/src/Qtx/QtxPopupMgr.h b/src/Qtx/QtxPopupMgr.h index 2dbea1280..9759f8c95 100644 --- a/src/Qtx/QtxPopupMgr.h +++ b/src/Qtx/QtxPopupMgr.h @@ -86,6 +86,9 @@ private: bool result( QtxEvalParser* p ) const; QVariant parameter( const QString&, const int = -1 ) const; +private slots: + void onSelectionDestroyed( QObject* ); + private: typedef QMap ExprMap; typedef QMap RuleMap; -- 2.39.2