summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2024-02-12 20:13:19 -0500
committerRusty Wagner <rusty.wagner@gmail.com>2024-02-12 20:33:49 -0500
commit698da3c5dc110190e5914f5db306c3482ddddb93 (patch)
tree503e3078d7470d2ddf57ebeed2aad6ce258bafd1
parent3da9ca6252eefcabf092ac1b2c623a93cf8a2749 (diff)
Fix crashes with Python action handlers by clearing the handler widget if the widget is deleted
-rw-r--r--ui/action.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/action.h b/ui/action.h
index 49f58b6a..766c240b 100644
--- a/ui/action.h
+++ b/ui/action.h
@@ -190,6 +190,20 @@ enum ActionPriority
HighActionPriority
};
+class UIActionHandler;
+
+class BINARYNINJAUIAPI UIActionHandlerWidgetConnection : public QObject
+{
+ Q_OBJECT
+
+ UIActionHandler* m_handler;
+ friend class UIActionHandler;
+
+public:
+ UIActionHandlerWidgetConnection(QWidget* widget, UIActionHandler* handler);
+ virtual ~UIActionHandlerWidgetConnection();
+};
+
/*!
\ingroup action
*/
@@ -200,12 +214,15 @@ class BINARYNINJAUIAPI UIActionHandler
std::map<QString, std::function<QString(const UIActionContext&)>> m_actionDisplayNames;
std::map<QString, std::function<bool(const UIActionContext&)>> m_checked;
QWidget* m_handlerWidget;
+ UIActionHandlerWidgetConnection* m_handlerWidgetConnection = nullptr;
std::map<QString, std::vector<QShortcut*>> m_handlerWidgetShortcuts;
UIActionHandler* m_parent;
std::set<UIActionHandler*> m_children;
bool m_isGlobal, m_inheritParentBindings;
std::function<UIActionContext()> m_actionContextOverride;
+ friend class UIActionHandlerWidgetConnection;
+
static std::map<QString, std::set<UIActionHandler*>> m_actionBindings;
static std::set<QString> m_globalMenuActions;