summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helpers/AsyncDialogBox.cpp9
-rw-r--r--src/helpers/AsyncDialogBox.hpp2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/helpers/AsyncDialogBox.cpp b/src/helpers/AsyncDialogBox.cpp
index 697d61ba..4ee5ccca 100644
--- a/src/helpers/AsyncDialogBox.cpp
+++ b/src/helpers/AsyncDialogBox.cpp
@@ -46,6 +46,9 @@ CAsyncDialogBox::CAsyncDialogBox(const std::string& title, const std::string& de
static int onFdWrite(int fd, uint32_t mask, void* data) {
auto box = (CAsyncDialogBox*)data;
+ // lock the box to prevent a UAF
+ auto lock = box->lockSelf();
+
box->onWrite(fd, mask);
return 0;
@@ -142,4 +145,8 @@ void CAsyncDialogBox::kill() {
bool CAsyncDialogBox::isRunning() const {
return m_readEventSource;
-} \ No newline at end of file
+}
+
+SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() {
+ return m_selfWeakReference.lock();
+}
diff --git a/src/helpers/AsyncDialogBox.hpp b/src/helpers/AsyncDialogBox.hpp
index 0ee0144e..5f94be0d 100644
--- a/src/helpers/AsyncDialogBox.hpp
+++ b/src/helpers/AsyncDialogBox.hpp
@@ -27,6 +27,8 @@ class CAsyncDialogBox {
void kill();
bool isRunning() const;
+ SP<CAsyncDialogBox> lockSelf();
+
// focus priority, only permission popups
bool m_priority = false;