Skip to content

Commit

Permalink
Fix crash due to the wrong window get returned in PointCtrl (SoftFe…
Browse files Browse the repository at this point in the history
…ver#6261).

`getWindow()` must return the control itself, not its child control; otherwise the child control will be destroyed twice when the tab container is destroyed.
  • Loading branch information
Noisyfox committed Aug 12, 2024
1 parent 7082e94 commit 41fca66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/slic3r/GUI/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,8 @@ boost::any& PointCtrl::get_value()
return m_value = Vec2d(x, y);
}

wxWindow* PointCtrl::getWindow() { return dynamic_cast<wxWindow*>(x_input); }

void StaticText::BUILD()
{
auto size = wxSize(wxDefaultSize);
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/Field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ class PointCtrl : public Field {
x_textctrl->Disable();
y_textctrl->Disable(); }
wxSizer* getSizer() override { return sizer; }
wxWindow* getWindow() override { return dynamic_cast<wxWindow*>(x_textctrl); }
wxWindow* getWindow() override;
};

class StaticText : public Field {
Expand Down

0 comments on commit 41fca66

Please sign in to comment.