# HG changeset patch # User Ideenmodellierer # Date 1764356255 -3600 # Node ID 177f640940f2fba665b111ddeac2a0694d5f279d # Parent 0b3630a29ad881d5b622fb515ec178b4bd2df733 Update exception class and cleanup redifinitions During firmware download and exception caused the application to stop. Rootcause was the defference between QT5 and QT6 exception and string handling which is updated now. In addition some old definitions were removed to avoid compiler warnings. diff -r 0b3630a29ad8 -r 177f640940f2 Serial.cpp --- a/Serial.cpp Thu Nov 27 18:40:28 2025 +0100 +++ b/Serial.cpp Fri Nov 28 19:57:35 2025 +0100 @@ -231,11 +231,9 @@ S_LEN len = 0; S_READ(_hSerial, &byte, 1, len); if( len != 1 ) - // LOG_THROW_E(ReadTimeout, "< timeout" ); - LOG_THROW("< timeout" ); + LOG_THROW_E(ReadTimeout, "< timeout" ); if( isprint(byte) ) - // LOG_DEBUG("< " << QString().sprintf("%02x '%c'", byte, byte) ); LOG_DEBUG("< " << QString::asprintf("%02x '%c'", byte, byte)); else LOG_DEBUG("< " << QString::asprintf("%02x", byte) ); diff -r 0b3630a29ad8 -r 177f640940f2 Utils/Exception.cpp --- a/Utils/Exception.cpp Thu Nov 27 18:40:28 2025 +0100 +++ b/Utils/Exception.cpp Fri Nov 28 19:57:35 2025 +0100 @@ -37,6 +37,18 @@ #include + +Exception::Exception(const QString& msg) + : _msg(msg.toStdString()) {} + +Exception::Exception(const char* msg) + : _msg(msg) {} + +const char* Exception::what() const noexcept { + return _msg.c_str(); +} + +#if 0 Exception::Exception(const char* msg) : _msg(strdup(msg)) {} @@ -54,3 +66,4 @@ { return _msg; } +#endif diff -r 0b3630a29ad8 -r 177f640940f2 Utils/Exception.h --- a/Utils/Exception.h Thu Nov 27 18:40:28 2025 +0100 +++ b/Utils/Exception.h Fri Nov 28 19:57:35 2025 +0100 @@ -51,6 +51,7 @@ # define EXPORT __declspec(dllimport) #endif +#if 0 class EXPORT Exception : public std::exception { @@ -65,6 +66,18 @@ /// Message contains, in UTF8 format. const char* what() const throw() override; }; +#endif + +class EXPORT Exception : public std::exception { +public: + explicit Exception(const QString& msg); + explicit Exception(const char* msg); + + const char* what() const noexcept override; + +private: + std::string _msg; +}; ////////////////////////////////////////////////////////////////////////////// diff -r 0b3630a29ad8 -r 177f640940f2 main.cpp --- a/main.cpp Thu Nov 27 18:40:28 2025 +0100 +++ b/main.cpp Fri Nov 28 19:57:35 2025 +0100 @@ -76,13 +76,14 @@ } \ } while(0) #endif +#if 0 #define LOG_TRACE(msg) \ do { \ if(Log::minLevel <= Log::LEVEL_TRACE) { \ LogAction(Log::LEVEL_TRACE, __FILE__, __LINE__, LOG_FUNCTION_) << QString("%1").arg(msg); \ } \ } while(0) - +#endif #ifdef Q_OS_WIN32 auto os = QOperatingSystemVersion::current();