diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf3dddf..0bf2165 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,14 @@ jobs: matrix: qt-version: [5.15.2, 6.4.1] library-type: [shared, static] - platform: [windows-latest, ubuntu-latest, macos-latest] + platform: [windows-latest, macos-latest] # ubuntu-latest include: - platform: windows-latest CC: cl CXX: cl - - platform: ubuntu-latest - CC: gcc - CXX: g++ + #- platform: ubuntu-latest + # CC: gcc + # CXX: g++ - platform: macos-latest CC: clang CXX: clang++ diff --git a/examples/shared/log.cpp b/examples/shared/log.cpp index aab4f78..5a465de 100644 --- a/examples/shared/log.cpp +++ b/examples/shared/log.cpp @@ -62,7 +62,7 @@ static inline void myMessageHandler(const QtMsgType type, const QMessageLogConte g_logFile->setFileName(FRAMELESSHELPER_STRING_LITERAL("debug-%1.log").arg(g_app)); if (!g_logFile->open(QFile::WriteOnly | QFile::Text | QFile::Append)) { std::cerr << "Can't open file to write: " << qUtf8Printable(g_logFile->errorString()) << std::endl; - delete g_logFile.release(); + g_logFile.reset(); g_logError = true; return; } diff --git a/src/core/framelessconfig.cpp b/src/core/framelessconfig.cpp index 09e99bd..69e52d8 100644 --- a/src/core/framelessconfig.cpp +++ b/src/core/framelessconfig.cpp @@ -107,13 +107,13 @@ void FramelessConfig::reload(const bool force) if (g_data()->loaded && !force) { return; } - const std::unique_ptr configFile([]() -> QSettings * { - if (!QCoreApplication::instance()) { + const auto configFile = []() -> std::unique_ptr { + if (!qApp) { return nullptr; } const QDir appDir(QCoreApplication::applicationDirPath()); - return new QSettings(appDir.filePath(kConfigFileName), QSettings::IniFormat); - }()); + return std::make_unique(appDir.filePath(kConfigFileName), QSettings::IniFormat); + }(); for (int i = 0; i != OptionCount; ++i) { const bool envVar = (!g_data()->disableEnvVar && qEnvironmentVariableIsSet(OptionsTable[i].env.constData()) diff --git a/src/core/framelesshelper_win.cpp b/src/core/framelesshelper_win.cpp index 5fa088e..63ed99e 100644 --- a/src/core/framelesshelper_win.cpp +++ b/src/core/framelesshelper_win.cpp @@ -588,7 +588,7 @@ void FramelessHelperWin::removeWindow(const WId windowId) if (g_win32Helper()->data.isEmpty()) { if (g_win32Helper()->nativeEventFilter) { qApp->removeNativeEventFilter(g_win32Helper()->nativeEventFilter.get()); - delete g_win32Helper()->nativeEventFilter.release(); + g_win32Helper()->nativeEventFilter.reset(); } } HWND hwnd = nullptr; diff --git a/src/core/registrykey.cpp b/src/core/registrykey.cpp index 6b9f8bc..25645b3 100644 --- a/src/core/registrykey.cpp +++ b/src/core/registrykey.cpp @@ -87,17 +87,17 @@ RegistryKey::RegistryKey(const RegistryRootKey root, const QString &key, QObject #if REGISTRYKEY_QWINREGISTRYKEY m_registryKey = std::make_unique(g_keyMap[static_cast(m_rootKey)], m_subKey); if (!m_registryKey->isValid()) { - delete m_registryKey.release(); + m_registryKey.reset(); } #else const QString rootKey = g_strMap[static_cast(m_rootKey)]; const auto lastSlashPos = m_subKey.lastIndexOf(u'\\'); m_settings = std::make_unique(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat); if (m_settings->childGroups().contains(m_subKey.mid(lastSlashPos + 1))) { - delete m_settings.release(); + m_settings.reset(); m_settings = std::make_unique(rootKey + u'\\' + m_subKey, QSettings::NativeFormat); } else { - delete m_settings.release(); + m_settings.reset(); } #endif }