diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-16 14:09:50 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-16 14:09:50 +0800 |
| commit | 07d662aafc25b145eb20e4123ebc82b5736cdeb7 (patch) | |
| tree | 0b94baddd3235623beac4997ac09a503a00645e7 /src/ui/controls | |
| parent | faf73c4af74bdae1abf394a33b573149b98ec2b1 (diff) | |
| download | cru-07d662aafc25b145eb20e4123ebc82b5736cdeb7.tar.gz cru-07d662aafc25b145eb20e4123ebc82b5736cdeb7.tar.bz2 cru-07d662aafc25b145eb20e4123ebc82b5736cdeb7.zip | |
New timer impl on Windows. Add Event test. Fix delete later.
Diffstat (limited to 'src/ui/controls')
| -rw-r--r-- | src/ui/controls/Control.cpp | 5 | ||||
| -rw-r--r-- | src/ui/controls/TextHostControlService.cpp | 6 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/ui/controls/Control.cpp b/src/ui/controls/Control.cpp index 3218f185..14397fa7 100644 --- a/src/ui/controls/Control.cpp +++ b/src/ui/controls/Control.cpp @@ -1,10 +1,8 @@ #include "cru/ui/controls/Control.h" -#include "cru/base/log/Logger.h" #include "cru/platform/gui/Cursor.h" #include "cru/platform/gui/UiApplication.h" #include "cru/ui/host/WindowHost.h" -#include "cru/ui/render/RenderObject.h" #include "cru/ui/style/StyleRuleSet.h" namespace cru::ui::controls { @@ -30,8 +28,7 @@ Control::Control() { Control::~Control() { if (host::WindowHost::IsInEventHandling()) { - CRU_LOG_TAG_ERROR( - "Control destroyed during event handling. Please use DeleteLater."); + std::terminate(); } in_destruction_ = true; diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp index 235e6e6a..f581d3c9 100644 --- a/src/ui/controls/TextHostControlService.cpp +++ b/src/ui/controls/TextHostControlService.cpp @@ -12,7 +12,6 @@ #include "cru/platform/gui/Window.h" #include "cru/ui/Base.h" #include "cru/ui/DebugFlags.h" -#include "cru/ui/DeleteLater.h" #include "cru/ui/components/Menu.h" #include "cru/ui/helper/ShortcutHub.h" #include "cru/ui/host/WindowHost.h" @@ -149,7 +148,8 @@ std::vector<TextControlMovePattern> TextControlMovePattern::kDefaultPatterns = { TextHostControlService::TextHostControlService(Control* control) : control_(control), - text_host_control_(dynamic_cast<ITextHostControl*>(control)) { + text_host_control_(dynamic_cast<ITextHostControl*>(control)), + context_menu_(new components::PopupMenu()) { SetUpShortcuts(); SetupOneHandler(&Control::MouseMoveEvent, @@ -699,7 +699,7 @@ void TextHostControlService::SetUpShortcuts() { void TextHostControlService::OpenContextMenu(const Point& position, ContextMenuItem items) { - context_menu_ = MakeDeleteLater<components::PopupMenu>(); + CRU_LOG_TAG_DEBUG("Open context menu."); auto menu = context_menu_->GetMenu(); if (items & ContextMenuItem::kSelectAll) { menu->AddTextItem("Select All", [this] { this->SelectAll(); }); |
