diff --git a/src/plugins/studiowelcome/CMakeLists.txt b/src/plugins/studiowelcome/CMakeLists.txt index 48c07d15b97..a8b92ab1f8b 100644 --- a/src/plugins/studiowelcome/CMakeLists.txt +++ b/src/plugins/studiowelcome/CMakeLists.txt @@ -1,6 +1,6 @@ add_qtc_plugin(StudioWelcome CONDITION TARGET Qt5::QuickWidgets AND TARGET QmlDesigner - DEPENDS Qt5::QuickWidgets + DEPENDS Qt5::QuickWidgets Qt5::QmlPrivate PLUGIN_DEPENDS Core ProjectExplorer QtSupport QmlDesigner DEFINES STUDIO_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/qml/" SOURCES diff --git a/src/plugins/studiowelcome/examplecheckout.cpp b/src/plugins/studiowelcome/examplecheckout.cpp index 45d7dd440fb..b094fd2f08a 100644 --- a/src/plugins/studiowelcome/examplecheckout.cpp +++ b/src/plugins/studiowelcome/examplecheckout.cpp @@ -31,6 +31,8 @@ #include #include +#include + #include #include #include @@ -247,6 +249,17 @@ void FileDownloader::probeUrl() }); QNetworkReply::connect(reply, &QNetworkReply::finished, this, [this, reply]() { + QQmlData *data = QQmlData::get(this, false); + if (!data) { + qDebug() << Q_FUNC_INFO << "FileDownloader is nullptr."; + return; + } + + if (QQmlData::wasDeleted(this)) { + qDebug() << Q_FUNC_INFO << "FileDownloader was deleted."; + return; + } + if (reply->error()) return; @@ -261,8 +274,17 @@ void FileDownloader::probeUrl() &QNetworkReply::errorOccurred, this, [this, reply](QNetworkReply::NetworkError code) { - // QNetworkReply::HostNotFoundError - // QNetworkReply::ContentNotFoundError + QQmlData *data = QQmlData::get(this, false); + if (!data) { + qDebug() << Q_FUNC_INFO << "FileDownloader is nullptr."; + return; + } + + if (QQmlData::wasDeleted(this)) { + qDebug() << Q_FUNC_INFO << "FileDownloader was deleted."; + return; + } + m_available = false; emit availableChanged(); });