diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2022-02-18 14:14:12 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2022-02-22 10:22:26 +0000 |
commit | c0a7487cd8bd4d8dbad05669b52de90276dc9e6e (patch) | |
tree | d374df6dbdc4054054c1c1a321a507816313072e | |
parent | 8058ed8e43f327e2a3288d627c380e2b6450a59a (diff) |
Fix package startup (remove ThreadHelper.ThrowIfNotOnUIThread())
Some of the methods in QtVersionManager were still expected
run on the UI thread, but that wasn't necessary and prevented
the package from loading properly.
Change-Id: Ia67ce4f28a971e154a0abdac1777a976e1cb0fae
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r-- | QtVsTools.Core/QtVersionManager.cs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/QtVsTools.Core/QtVersionManager.cs b/QtVsTools.Core/QtVersionManager.cs index db31cd60..3618d6d7 100644 --- a/QtVsTools.Core/QtVersionManager.cs +++ b/QtVsTools.Core/QtVersionManager.cs @@ -49,8 +49,6 @@ namespace QtVsTools.Core protected QtVersionManager() { - ThreadHelper.ThrowIfNotOnUIThread(); - strVersionKey = "Versions"; regVersionPath = Resources.registryVersionPath; RefreshVersionNames(); @@ -64,9 +62,7 @@ namespace QtVsTools.Core using (var versionsKey = rootKey.OpenSubKey(strVersionKey, true)) { versionsKey.SetValue("VersionNames", string.Join(";", GetVersions())); } - } catch (Exception e) { - ThreadHelper.ThrowIfNotOnUIThread(); Messages.Print(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace); } } @@ -91,8 +87,6 @@ namespace QtVsTools.Core public VersionInformation GetVersionInfo(string name) { - ThreadHelper.ThrowIfNotOnUIThread(); - if (name == "$(DefaultQtVersion)") name = GetDefaultVersion(); if (name == null) @@ -123,8 +117,6 @@ namespace QtVsTools.Core public string GetQtVersionFromInstallDir(string qtDir) { - ThreadHelper.ThrowIfNotOnUIThread(); - if (qtDir == null) return null; @@ -160,8 +152,6 @@ namespace QtVsTools.Core /// <returns>true, if we found an invalid version</returns> public bool HasInvalidVersions(out string errorMessage) { - ThreadHelper.ThrowIfNotOnUIThread(); - var validVersions = new Dictionary<string, QtConfig>(); var invalidVersions = new List<string>(); @@ -239,8 +229,6 @@ namespace QtVsTools.Core public string GetInstallPath(string version) { - ThreadHelper.ThrowIfNotOnUIThread(); - if (version == "$(DefaultQtVersion)") version = GetDefaultVersion(); return GetInstallPath(version, Registry.CurrentUser); @@ -248,8 +236,6 @@ namespace QtVsTools.Core public string GetInstallPath(string version, RegistryKey root) { - ThreadHelper.ThrowIfNotOnUIThread(); - if (version == "$(DefaultQtVersion)") version = GetDefaultVersion(root); if (version == "$(QTDIR)") @@ -278,8 +264,6 @@ namespace QtVsTools.Core public bool SaveVersion(string versionName, string path, bool checkPath = true) { - ThreadHelper.ThrowIfNotOnUIThread(); - var verName = versionName?.Trim().Replace(@"\", "_"); if (string.IsNullOrEmpty(verName)) return false; @@ -323,8 +307,6 @@ namespace QtVsTools.Core public void RemoveVersion(string versionName) { - ThreadHelper.ThrowIfNotOnUIThread(); - var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\" + regVersionPath, true); if (key == null) return; @@ -478,14 +460,11 @@ namespace QtVsTools.Core public string GetDefaultVersion() { - ThreadHelper.ThrowIfNotOnUIThread(); return GetDefaultVersion(Registry.CurrentUser); } public string GetDefaultVersion(RegistryKey root) { - ThreadHelper.ThrowIfNotOnUIThread(); - string defaultVersion = null; try { var key = root.OpenSubKey("SOFTWARE\\" + regVersionPath, false); @@ -495,8 +474,6 @@ namespace QtVsTools.Core Messages.DisplayWarningMessage(SR.GetString("QtVersionManager_CannotLoadQtVersion")); } - ThreadHelper.ThrowIfNotOnUIThread(); - if (defaultVersion == null) { MergeVersions(); var key = root.OpenSubKey("SOFTWARE\\" + regVersionPath, false); @@ -534,8 +511,6 @@ namespace QtVsTools.Core private void MergeVersions() { - ThreadHelper.ThrowIfNotOnUIThread(); - var hkcuVersions = GetVersions(); var hklmVersions = GetVersions(Registry.LocalMachine); @@ -574,8 +549,6 @@ namespace QtVsTools.Core private bool VerifyIfQtVersionExists(string version) { - ThreadHelper.ThrowIfNotOnUIThread(); - if (version == "$(DefaultQtVersion)") version = GetDefaultVersion(); if (!string.IsNullOrEmpty(version)) { |