From 8e700818796c12b7c66fe7d4443956d70a68410e Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Tue, 3 Oct 2023 11:03:19 -0500 Subject: [PATCH] Fix issue that the slice button is still disabled after a tick is deleted (#2308) Fix an UAF which causes the slice button being disabled after a tick is deleted --- src/slic3r/GUI/IMSlider.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/IMSlider.cpp b/src/slic3r/GUI/IMSlider.cpp index f12d78c5bbf..e8eb32ef1e9 100644 --- a/src/slic3r/GUI/IMSlider.cpp +++ b/src/slic3r/GUI/IMSlider.cpp @@ -405,8 +405,9 @@ void IMSlider::add_code_as_tick(Type type, int selected_extruder) } void IMSlider::delete_tick(const TickCode& tick) { + Type t = tick.type; // Avoid Use-After-Free issue, which resets the tick.type to 0 m_ticks.ticks.erase(tick); - post_ticks_changed_event(tick.type); + post_ticks_changed_event(t); } bool IMSlider::check_ticks_changed_event(Type type)