summaryrefslogtreecommitdiff
path: root/src/gui/widgets/windowcontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/windowcontainer.cpp')
-rw-r--r--src/gui/widgets/windowcontainer.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index a0e4e8dad..a275b7cb1 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -24,6 +24,7 @@
#include "gui/widgets/window.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "utils/foreach.h"
@@ -33,7 +34,8 @@ WindowContainer *windowContainer = nullptr;
WindowContainer::WindowContainer(const Widget2 *const widget) :
Container(widget),
- mDeathList()
+ mDeathList(),
+ mDeathSet()
{
}
@@ -41,12 +43,24 @@ void WindowContainer::slowLogic()
{
delete_all(mDeathList);
mDeathList.clear();
+ mDeathSet.clear();
}
void WindowContainer::scheduleDelete(Widget *const widget)
{
- if (widget != nullptr)
+ if (widget == nullptr)
+ return;
+
+ if (mDeathSet.find(widget) == mDeathSet.end())
+ {
mDeathList.push_back(widget);
+ mDeathSet.insert(widget);
+ }
+ else
+ {
+ reportAlways("double adding pointer %p for deletion in scheduleDelete",
+ static_cast<void*>(widget));
+ }
}
void WindowContainer::adjustAfterResize(const int oldScreenWidth,