Skip to content

Commit 74203b7

Browse files
committed
Tweaking some flag setting and double checking a dangling pointer.
1 parent b7a18de commit 74203b7

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

visage_ui/frame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ namespace visage {
369369

370370
void Frame::eraseChild(Frame* child) {
371371
child->parent_ = nullptr;
372-
child->event_handler_ = nullptr;
372+
child->setEventHandler(nullptr);
373373
region_.removeRegion(child->region());
374374
children_.erase(std::find(children_.begin(), children_.end(), child));
375375
}

visage_ui/frame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ namespace visage {
204204
void addChild(Frame& child, bool make_visible = true) { addChild(&child, make_visible); }
205205
void addChild(std::unique_ptr<Frame> child, bool make_visible = true);
206206
void removeChild(Frame* child);
207+
void removeChild(Frame& child) { removeChild(&child); }
207208
void removeAllChildren();
208209
int indexOfChild(const Frame* child) const;
209210
void setParent(Frame* parent) {
@@ -218,6 +219,7 @@ namespace visage {
218219

219220
void setEventHandler(FrameEventHandler* handler) {
220221
event_handler_ = handler;
222+
redrawing_ = false;
221223
for (Frame* child : children_)
222224
child->setEventHandler(handler);
223225
}
@@ -337,8 +339,6 @@ namespace visage {
337339

338340
if (event_handler_ && event_handler_->remove_from_hierarchy)
339341
event_handler_->remove_from_hierarchy(this);
340-
341-
redrawing_ = false;
342342
}
343343

344344
void setMouseRelativeMode(bool visible) {

0 commit comments

Comments
 (0)