forked from qt-creator/qt-creator
CompilerExplorer: Un-static NetworkAccessManager
We have seen crashes on Windows when the static network access manager is deleted (with a "dev" version of Qt). Out of an abundance of caution this patch changes the Network access manager to be owned by the actual settings object. Change-Id: I999a15d99315019b3e5f4ed330a4ac058849f066 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -306,8 +306,7 @@ CompilerExplorerSettings::CompilerExplorerSettings()
|
||||
{
|
||||
setAutoApply(false);
|
||||
setSettingsKey("CompilerExplorer");
|
||||
static QNetworkAccessManager networkManager;
|
||||
m_networkAccessManager = &networkManager;
|
||||
m_networkAccessManager = std::make_unique<QNetworkAccessManager>();
|
||||
|
||||
compilerExplorerUrl.setSettingsKey("CompilerExplorerUrl");
|
||||
compilerExplorerUrl.setLabelText(Tr::tr("Compiler Explorer URL:"));
|
||||
|
@@ -40,13 +40,11 @@ public:
|
||||
|
||||
Api::Config apiConfig() const
|
||||
{
|
||||
return Api::Config(m_networkAccessManager, compilerExplorerUrl());
|
||||
return Api::Config(m_networkAccessManager.get(), compilerExplorerUrl());
|
||||
}
|
||||
|
||||
QNetworkAccessManager *networkAccessManager() const { return m_networkAccessManager; }
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *m_networkAccessManager{nullptr};
|
||||
std::unique_ptr<QNetworkAccessManager> m_networkAccessManager;
|
||||
};
|
||||
|
||||
class SourceSettings : public Utils::AspectContainer,
|
||||
|
Reference in New Issue
Block a user