aboutsummaryrefslogtreecommitdiff
path: root/src/ui/DeleteLater.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-16 12:14:47 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-16 12:14:47 +0800
commitfaf73c4af74bdae1abf394a33b573149b98ec2b1 (patch)
treeaa985593c35a256e7190eddf47e023962a717ade /src/ui/DeleteLater.cpp
parent4e0b7d82cd64ef8016dcb49247a8a5e4de8a0b3d (diff)
downloadcru-faf73c4af74bdae1abf394a33b573149b98ec2b1.tar.gz
cru-faf73c4af74bdae1abf394a33b573149b98ec2b1.tar.bz2
cru-faf73c4af74bdae1abf394a33b573149b98ec2b1.zip
Clean DeleteLater.
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() {}