summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2022-06-15 07:37:46 -0400
committerBrian Potchik <brian@vector35.com>2022-06-15 07:37:46 -0400
commit304a6d4d5dbf95b7f4d71f72e17d724b6572bcce (patch)
tree636f77d4dd33e94f679726027d33a214c498ac01
parent61175fae519563633cb3691e0b67d0e53d563397 (diff)
Prefer lazy menu deletion to minimize chance of UAF when using context menu/actions.
-rw-r--r--ui/menus.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/menus.h b/ui/menus.h
index 20464d62..ee2e8780 100644
--- a/ui/menus.h
+++ b/ui/menus.h
@@ -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();