Fix crash when loading gcode file twice (#7217)

* Fix ASAN use-after-free error when loading 3mf file with gcode by drag-and-drop

* Fix crash when loading gcode file twice
This commit is contained in:
Noisyfox 2024-10-26 21:29:03 +08:00 committed by GitHub
parent 88ca0bc5b9
commit 2348928b25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10128,6 +10128,10 @@ void Plater::load_gcode(const wxString& filename)
set_project_filename(filename); set_project_filename(filename);
} }
// Orca: Fix crash when loading gcode file multiple times
if (m_only_gcode) {
p->view3D->get_canvas3d()->remove_raycasters_for_picking(SceneRaycaster::EType::Bed);
}
} }
void Plater::reload_gcode_from_disk() void Plater::reload_gcode_from_disk()
@ -12347,7 +12351,6 @@ void Plater::reslice()
// Post the "complete" callback message, so that it will slice the next plate soon // Post the "complete" callback message, so that it will slice the next plate soon
wxQueueEvent(this, evt.Clone()); wxQueueEvent(this, evt.Clone());
p->m_is_slicing = true; p->m_is_slicing = true;
this->SetDropTarget(nullptr);
if (p->m_cur_slice_plate == 0) if (p->m_cur_slice_plate == 0)
reset_gcode_toolpaths(); reset_gcode_toolpaths();
return; return;
@ -12355,7 +12358,6 @@ void Plater::reslice()
if (result) { if (result) {
p->m_is_slicing = true; p->m_is_slicing = true;
this->SetDropTarget(nullptr);
} }
bool clean_gcode_toolpaths = true; bool clean_gcode_toolpaths = true;