Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavelMikus <pavel.mikus.mail@seznam.cz>2022-06-06 13:30:52 +0300
committersupermerill <merill@free.fr>2022-08-11 00:44:01 +0300
commit7b7af074d7851ac016f61aa079c5d9238fb62ba1 (patch)
tree1d7fa9350c6942d48c9a00f1ae10e4ebaba5ff69 /src
parentb13ca1eb7fe523dbb4b41865de4a3a44b46d21f0 (diff)
fix deadlock condition varaible use in netfabb wrapper
Diffstat (limited to 'src')
-rw-r--r--src/slic3r/Utils/FixModelByWin10.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/slic3r/Utils/FixModelByWin10.cpp b/src/slic3r/Utils/FixModelByWin10.cpp
index 8ef94ad85..10ed0d5da 100644
--- a/src/slic3r/Utils/FixModelByWin10.cpp
+++ b/src/slic3r/Utils/FixModelByWin10.cpp
@@ -326,9 +326,8 @@ public:
// fix_result containes a message if fixing failed
bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, wxProgressDialog& progress_dialog, const wxString& msg_header, std::string& fix_result)
{
- std::mutex mutex;
- std::condition_variable condition;
- std::unique_lock<std::mutex> lock(mutex);
+ std::mutex mtx;
+ std::condition_variable condition;
struct Progress {
std::string message;
int percent = 0;
@@ -347,8 +346,8 @@ bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, wxPro
// (It seems like wxWidgets initialize the COM contex as single threaded and we need a multi-threaded context).
bool success = false;
size_t ivolume = 0;
- auto on_progress = [&mutex, &condition, &ivolume, &volumes, &progress](const char *msg, unsigned prcnt) {
- std::lock_guard<std::mutex> lk(mutex);
+ auto on_progress = [&mtx, &condition, &ivolume, &volumes, &progress](const char *msg, unsigned prcnt) {
+ std::unique_lock<std::mutex> lock(mtx);
progress.message = msg;
progress.percent = (int)floor((float(prcnt) + float(ivolume) * 100.f) / float(volumes.size()));
progress.updated = true;
@@ -424,6 +423,7 @@ bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, wxPro
}
});
while (! finished) {
+ std::unique_lock<std::mutex> lock(mtx);
condition.wait_for(lock, std::chrono::milliseconds(250), [&progress]{ return progress.updated; });
// decrease progress.percent value to avoid closing of the progress dialog
if (!progress_dialog.Update(progress.percent-1, msg_header + _(progress.message)))