diff options
Diffstat (limited to 'src/widgets/kernel/qaction.cpp')
-rw-r--r-- | src/widgets/kernel/qaction.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 22162895f7..15954abf8c 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -1185,22 +1185,19 @@ void QAction::activate(ActionEvent event) { Q_D(QAction); if(event == Trigger) { - QObject *guard = this; - QMetaObject::addGuard(&guard); + QWeakPointer<QObject> guard = this; if(d->checkable) { // the checked action of an exclusive group cannot be unchecked if (d->checked && (d->group && d->group->isExclusive() && d->group->checkedAction() == this)) { - if (guard) + if (!guard.isNull()) emit triggered(true); - QMetaObject::removeGuard(&guard); return; } setChecked(!d->checked); } - if (guard) + if (!guard.isNull()) emit triggered(d->checked); - QMetaObject::removeGuard(&guard); } else if(event == Hover) { emit hovered(); } |