From 698da3c5dc110190e5914f5db306c3482ddddb93 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 12 Feb 2024 20:13:19 -0500 Subject: Fix crashes with Python action handlers by clearing the handler widget if the widget is deleted --- ui/action.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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> m_actionDisplayNames; std::map> m_checked; QWidget* m_handlerWidget; + UIActionHandlerWidgetConnection* m_handlerWidgetConnection = nullptr; std::map> m_handlerWidgetShortcuts; UIActionHandler* m_parent; std::set m_children; bool m_isGlobal, m_inheritParentBindings; std::function m_actionContextOverride; + friend class UIActionHandlerWidgetConnection; + static std::map> m_actionBindings; static std::set m_globalMenuActions; -- cgit v1.3.1