[PATCH 1/5] Restructure ReadSettingsThread::run

Anton Lundin glance at acc.umu.se
Wed May 27 12:19:09 PDT 2015


This moves the dc_device_close call inside the if case for
dc_device_open, to get rid of the special error case and to look and
behave the same as the other ::run calls.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 configuredivecomputerthreads.cpp | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index 418a793..50cdc68 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -1508,17 +1508,15 @@ void ReadSettingsThread::run()
 			supported = false;
 			break;
 		}
+		dc_device_close(m_data->device);
+
+		if (!supported) {
+			lastError = tr("This feature is not yet available for the selected dive computer.");
+			emit error(lastError);
+		}
 	} else {
 		lastError = tr("Could not a establish connection to the dive computer.");
 		emit error(lastError);
-		// So we don't trigger the "unsupported" clause later..
-		supported = true;
-	}
-	dc_device_close(m_data->device);
-
-	if (!supported) {
-		lastError = tr("This feature is not yet available for the selected dive computer.");
-		emit error(lastError);
 	}
 }
 
-- 
2.1.4



More information about the subsurface mailing list