diff options
author | bubnikv <bubnikv@gmail.com> | 2020-03-09 12:36:55 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2020-03-09 12:36:55 +0300 |
commit | ec75b760b8e7277ed90f0e4cd7113190db4607bf (patch) | |
tree | 41bcf19c3fd29db9555652a621ecc61bdc4f920d /src/slic3r | |
parent | 6723b5f3cd2dd164971594d249682a3a11b8925a (diff) |
Fix of saving the 3DConnexion status on OSX.
Fixes 2.2.0 RC2 - 3Dconnexion settings not saved / Zoom digital (#3791)
Diffstat (limited to 'src/slic3r')
-rw-r--r-- | src/slic3r/GUI/Mouse3DController.cpp | 10 | ||||
-rw-r--r-- | src/slic3r/GUI/Mouse3DHandlerMac.mm | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 8bc9744f1..0cd39b092 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -368,6 +368,8 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const void Mouse3DController::connected(std::string device_name) { + assert(! m_connected); + assert(m_device_str.empty()); m_device_str = device_name; // Copy the parameters for m_device_str into the current parameters. if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) { @@ -380,13 +382,13 @@ void Mouse3DController::connected(std::string device_name) void Mouse3DController::disconnected() { // Copy the current parameters for m_device_str into the parameter database. - assert(! m_device_str.empty()); - if (! m_device_str.empty()) { + assert(m_connected == ! m_device_str.empty()); + if (m_connected) { tbb::mutex::scoped_lock lock(m_params_ui_mutex); m_params_by_device[m_device_str] = m_params_ui; + m_device_str.clear(); + m_connected = false; } - m_device_str.clear(); - m_connected = false; } bool Mouse3DController::handle_input(const DataPacketAxis& packet) diff --git a/src/slic3r/GUI/Mouse3DHandlerMac.mm b/src/slic3r/GUI/Mouse3DHandlerMac.mm index d40948cd1..eaf580908 100644 --- a/src/slic3r/GUI/Mouse3DHandlerMac.mm +++ b/src/slic3r/GUI/Mouse3DHandlerMac.mm @@ -152,6 +152,8 @@ static void DeviceAdded(uint32_t unused) static void DeviceRemoved(uint32_t unused) { BOOST_LOG_TRIVIAL(info) << "3dx device removed\n"; + assert(m_connected); + assert(! m_device_str.empty()); mouse_3d_controller->disconnected(); } @@ -214,6 +216,8 @@ void Mouse3DController::shutdown() CleanupConnexionHandlers(); unload_driver(); } + // Copy the current parameters to parameter database, mark the device as disconnected. + this->disconnected(); mouse_3d_controller = nullptr; } |