diff options
| author | Brian Potchik <brian@vector35.com> | 2022-06-15 07:37:46 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2022-06-15 07:37:46 -0400 |
| commit | 304a6d4d5dbf95b7f4d71f72e17d724b6572bcce (patch) | |
| tree | 636f77d4dd33e94f679726027d33a214c498ac01 | |
| parent | 61175fae519563633cb3691e0b67d0e53d563397 (diff) | |
Prefer lazy menu deletion to minimize chance of UAF when using context menu/actions.
| -rw-r--r-- | ui/menus.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,6 +1,5 @@ #pragma once -#include <QtCore/QPointer> #include <QtCore/QTimer> #include <QtWidgets/QLabel> #include <QtWidgets/QMenu> @@ -17,8 +16,9 @@ class BINARYNINJAUIAPI ContextMenuManager : public QObject Q_OBJECT QWidget* m_parent; - QPointer<QMenu> m_menu; + QMenu* m_menu; MenuInstance* m_instance; + bool m_isActive = false; public: ContextMenuManager() : m_parent(nullptr), m_menu(nullptr), m_instance(nullptr) {} @@ -29,7 +29,7 @@ class BINARYNINJAUIAPI ContextMenuManager : public QObject MenuInstance* show(QPoint pos, View* view); MenuInstance* show(Menu* source, UIActionHandler* handler); MenuInstance* show(QPoint pos, Menu* source, UIActionHandler* handler); - bool isActive() { return !m_menu.isNull(); } + bool isActive() { return m_isActive; } Q_SIGNALS: void onOpen(); |
