aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/components/Component.h4
-rw-r--r--include/cru/ui/controls/TextHostControlService.h4
2 files changed, 3 insertions, 5 deletions
diff --git a/include/cru/ui/components/Component.h b/include/cru/ui/components/Component.h
index 627e2d3c..6d31ae79 100644
--- a/include/cru/ui/components/Component.h
+++ b/include/cru/ui/components/Component.h
@@ -19,9 +19,7 @@ class CRU_UI_API Component : public Object, public DeleteLaterImpl {
void SetDeleteByParent(bool delete_by_parent) {
delete_by_parent_ = delete_by_parent;
}
- void DeleteIfDeleteByParent() const {
- if (delete_by_parent_) delete this;
- }
+ void DeleteIfDeleteByParent(bool delete_later = true);
protected:
void OnPrepareDelete() override;
diff --git a/include/cru/ui/controls/TextHostControlService.h b/include/cru/ui/controls/TextHostControlService.h
index e1586e66..454be09b 100644
--- a/include/cru/ui/controls/TextHostControlService.h
+++ b/include/cru/ui/controls/TextHostControlService.h
@@ -2,6 +2,7 @@
#include "../render/TextRenderObject.h"
#include "cru/platform/gui/InputMethod.h"
#include "cru/platform/gui/UiApplication.h"
+#include "cru/ui/DeleteLater.h"
#include "cru/ui/controls/Control.h"
#include "cru/ui/helper/ShortcutHub.h"
@@ -205,7 +206,6 @@ class CRU_UI_API TextHostControlService : public Object {
// true if left mouse is down and selecting
bool mouse_move_selecting_ = false;
- bool context_menu_dirty_ = true;
- std::unique_ptr<components::PopupMenu> context_menu_;
+ DeleteLaterPtr<components::PopupMenu> context_menu_;
};
} // namespace cru::ui::controls