aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2020-12-15 12:23:21 +0100
committerMiguel Costa <miguel.costa@qt.io>2020-12-17 13:20:55 +0000
commit81dc6c30e2532325ef798cd77ca4b18f0aece569 (patch)
treeb5c8264b055d9b5feabed2681e1c64bfb07fb6d4
parent834e18e12ad6bdb9ef52a529df833ca6b12f41d1 (diff)
Fix QML debug blocked after first session
Fixed a bug where QML debugging would only work for the first session and all subsequent debug sessions would block waiting for a connection between the QML runtime and the debugger. Change-Id: Id5f6a7e3a99687de617ce8142e540cd4e3c9509d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/qtvstools/QML/Debugging/QmlDebugLauncher.cs33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs b/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs
index 42cde652..74d0c746 100644
--- a/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs
+++ b/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs
@@ -50,12 +50,10 @@ namespace QtVsTools.Qml.Debug
public static Launcher Instance { get; private set; }
IVsDebugger debugger;
IVsDebugger4 debugger4;
- bool started;
- HashSet<Guid> excludedProjects;
- readonly Guid idThreadCreateEvent = new Guid("2090CCFC-70C5-491D-A5E8-BAD2DD9EE3EA");
- readonly Guid idLoadCompleteEvent = new Guid("B1844850-1349-45D4-9F12-495212F5EB0B");
- readonly Guid idProgramDestroyEvent = new Guid("E147E9E3-6440-4073-A7B7-A65592C714B5");
+ HashSet<Guid> _ExcludedProcesses;
+ HashSet<Guid> ExcludedProcesses => _ExcludedProcesses
+ ?? (_ExcludedProcesses = new HashSet<Guid>());
public static void Initialize()
{
@@ -66,11 +64,6 @@ namespace QtVsTools.Qml.Debug
Instance.debugger.AdviseDebugEventCallback(Instance);
}
- private Launcher()
- {
- excludedProjects = new HashSet<Guid>();
- }
-
protected override void DisposeManaged()
{
if (debugger != null)
@@ -86,9 +79,8 @@ namespace QtVsTools.Qml.Debug
ref Guid riidEvent,
uint dwAttrib)
{
- if (riidEvent != idThreadCreateEvent
- && riidEvent != idLoadCompleteEvent
- && riidEvent != idProgramDestroyEvent) {
+ if (riidEvent != typeof(IDebugThreadCreateEvent2).GUID
+ && riidEvent != typeof(IDebugProgramDestroyEvent2).GUID) {
return VSConstants.S_OK;
}
@@ -100,13 +92,13 @@ namespace QtVsTools.Qml.Debug
return VSConstants.S_OK;
// Run only once per process
- if (riidEvent == idProgramDestroyEvent) {
- excludedProjects.Remove(procGuid);
+ if (riidEvent == typeof(IDebugProgramDestroyEvent2).GUID) {
+ ExcludedProcesses.Remove(procGuid);
return VSConstants.S_OK;
- } else if (excludedProjects.Contains(procGuid)) {
+ } else if (ExcludedProcesses.Contains(procGuid)) {
return VSConstants.S_OK;
} else {
- excludedProjects.Add(procGuid);
+ ExcludedProcesses.Add(procGuid);
}
if (!(pEvent is IDebugLoadCompleteEvent2 || pEvent is IDebugThreadCreateEvent2))
@@ -124,11 +116,6 @@ namespace QtVsTools.Qml.Debug
else
return VSConstants.S_OK;
- if (pEvent is IDebugLoadCompleteEvent2)
- started = false;
- else if (started)
- return VSConstants.S_OK;
-
string execPath;
uint procId;
if (!GetProcessInfo(pProcess, native, out execPath, out procId))
@@ -139,8 +126,6 @@ namespace QtVsTools.Qml.Debug
if (!GetProjectInfo(execPath, native, out execCmd, out rccItems))
return VSConstants.S_OK;
- started = true;
-
LaunchDebug(execPath, execCmd, procId, rccItems);
return VSConstants.S_OK;
}