mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:15:53 +08:00
Fix for #10941 - Prusa 2.6.0 freezes when trying to change color
This commit is contained in:
parent
e9d967f4b2
commit
096d10ef62
@ -2757,6 +2757,11 @@ bool TickCodeInfo::add_tick(const int tick, Type type, const int extruder, doubl
|
||||
|
||||
bool TickCodeInfo::edit_tick(std::set<TickCode>::iterator it, double print_z)
|
||||
{
|
||||
// Save previously value of the tick before the call a Dialog from get_... functions,
|
||||
// otherwise a background process can change ticks values and current iterator wouldn't be valid for the moment of a Dialog close
|
||||
// and PS will crash (see https://github.com/prusa3d/PrusaSlicer/issues/10941)
|
||||
TickCode changed_tick = *it;
|
||||
|
||||
std::string edited_value;
|
||||
if (it->type == ColorChange)
|
||||
edited_value = get_new_color(it->color);
|
||||
@ -2768,7 +2773,10 @@ bool TickCodeInfo::edit_tick(std::set<TickCode>::iterator it, double print_z)
|
||||
if (edited_value.empty())
|
||||
return false;
|
||||
|
||||
TickCode changed_tick = *it;
|
||||
// Update iterator. For this moment its value can be invalid
|
||||
if (it = ticks.find(changed_tick); it == ticks.end())
|
||||
return false;
|
||||
|
||||
if (it->type == ColorChange) {
|
||||
if (it->color == edited_value)
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user