aboutsummaryrefslogtreecommitdiff
path: root/src/ui/DeleteLater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/DeleteLater.cpp')
-rw-r--r--src/ui/DeleteLater.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/DeleteLater.cpp b/src/ui/DeleteLater.cpp
index f8911ae1..499b9b34 100644
--- a/src/ui/DeleteLater.cpp
+++ b/src/ui/DeleteLater.cpp
@@ -4,10 +4,16 @@
#include "cru/platform/gui/UiApplication.h"
namespace cru::ui {
+
+DeleteLaterImpl::DeleteLaterImpl() : delete_later_scheduled_(false) {}
+
DeleteLaterImpl::~DeleteLaterImpl() {}
void DeleteLaterImpl::DeleteLater() {
- GetUiApplication()->SetImmediate([this] { delete this; });
+ if (!delete_later_scheduled_) {
+ GetUiApplication()->SetImmediate([this] { delete this; });
+ delete_later_scheduled_ = true;
+ }
}
void DeleteLaterImpl::OnPrepareDelete() {}