FIX: the exported Gcode file is stuck when imported on Mac

suppressed_backround_processing_update when loading gcode to prevent deadlock.

jira: STUDIO-13899
Change-Id: Iad4f20cd5249bb5133146197bb1bc32101b08bdf
(cherry picked from commit 2579cdc7adb98c1f21c3169a9fcebba60597fb43)
(cherry picked from commit 13b14414e03e3907d9d1662cdab570c754200618)
This commit is contained in:
songwei.li
2025-08-22 11:24:42 +08:00
committed by Noisyfox
parent 6c74e5f45a
commit e8d8fb5c7a

View File

@@ -961,12 +961,14 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
reset();
//BBS: add mutex for protection of gcode result
wxGetApp().plater()->suppress_background_process(true);
gcode_result.lock();
//BBS: add safe check
if (gcode_result.moves.size() == 0) {
//result cleaned before slicing ,should return here
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": gcode result reset before, return directly!");
gcode_result.unlock();
wxGetApp().plater()->schedule_background_process();
return;
}
@@ -1002,6 +1004,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
//BBS: add mutex for protection of gcode result
if (m_layers.empty()) {
gcode_result.unlock();
wxGetApp().plater()->schedule_background_process();
return;
}
@@ -1104,6 +1107,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
filament_printable_reuslt = gcode_result.filament_printable_reuslt;
//BBS: add mutex for protection of gcode result
gcode_result.unlock();
wxGetApp().plater()->schedule_background_process();
//BBS: add logs
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": finished, m_buffers size %1%!")%m_buffers.size();
}