Permalink
Browse files

fix flickering in debugger pads

  • Loading branch information...
siegfriedpammer committed Mar 6, 2012
1 parent f5e1507 commit 03612a691a6f03290cec737b2058c3548d1a91f3
@@ -2,6 +2,7 @@
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
using System.Collections.ObjectModel;
+using System.Linq;
using System.Windows.Threading;
using Debugger;
using Debugger.AddIn.Pads.Controls;
@@ -62,29 +63,22 @@ protected override void RefreshPad()
return;
}
- using(new PrintTimes("Local Variables refresh")) {
- try {
- StackFrame frame = debuggedProcess.GetCurrentExecutingFrame();
- if (frame == null) return;
-
- localVarList.WatchItems.Clear();
- foreach (var n in new StackFrameNode(frame).ChildNodes) {
- var node = n;
- debuggedProcess.EnqueueWork(
- Dispatcher.CurrentDispatcher,
- delegate {
- localVarList.WatchItems.Add(node.ToSharpTreeNode());
- }
- );
- }
- }
- catch(AbortedBecauseDebuggeeResumedException) { }
- catch(Exception ex) {
- if (debuggedProcess == null || debuggedProcess.HasExited) {
- // Process unexpectedly exited
- } else {
- MessageService.ShowException(ex);
- }
+ LoggingService.Info("Local Variables refresh");
+ try {
+ StackFrame frame = debuggedProcess.GetCurrentExecutingFrame();
+ if (frame == null) return;
+
+ localVarList.WatchItems.Clear();
+ debuggedProcess.EnqueueForEach(
+ Dispatcher.CurrentDispatcher,
+ new StackFrameNode(frame).ChildNodes.ToList(),
+ n => localVarList.WatchItems.Add(n.ToSharpTreeNode())
+ );
+ } catch (Exception ex) {
+ if (debuggedProcess == null || debuggedProcess.HasExited) {
+ // Process unexpectedly exited
+ } else {
+ MessageService.ShowException(ex);
}
}
}
@@ -3,6 +3,7 @@
using System;
using System.Collections.ObjectModel;
+using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@@ -91,21 +92,13 @@ protected override void RefreshPad()
return;
}
- using(new PrintTimes("Threads refresh")) {
- try {
- foreach (var t in debuggedProcess.Threads) {
- var thread = t;
- debuggedProcess.EnqueueWork(Dispatcher.CurrentDispatcher, () => AddThread(thread));
- }
- } catch(AbortedBecauseDebuggeeResumedException) {
- } catch(Exception) {
- if (debuggedProcess == null || debuggedProcess.HasExited) {
- // Process unexpectedly exited
- } else {
- throw;
- }
- }
- }
+ LoggingService.Info("Threads refresh");
+
+ debuggedProcess.EnqueueForEach(
+ Dispatcher.CurrentDispatcher,
+ debuggedProcess.Threads.ToList(),
+ t => AddThread(t)
+ );
}
void RunningThreadsListItemActivate(object sender, EventArgs e)
@@ -213,15 +213,12 @@ protected override void RefreshPad()
using(new PrintTimes("Watch Pad refresh")) {
var nodes = watchList.WatchItems.OfType<TreeNodeWrapper>().ToArray();
watchList.WatchItems.Clear();
- foreach (var n in nodes) {
- var node = n;
- debuggedProcess.EnqueueWork(
- Dispatcher.CurrentDispatcher,
- delegate {
- watchList.WatchItems.Add(UpdateNode(node));
- }
- );
- }
+
+ debuggedProcess.EnqueueForEach(
+ Dispatcher.CurrentDispatcher,
+ nodes,
+ n => watchList.WatchItems.Add(UpdateNode(n))
+ );
}
}
}

0 comments on commit 03612a6

Please sign in to comment.