Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hutchinson <m.j.hutchinson@gmail.com>2013-03-06 09:09:01 +0400
committerMichael Hutchinson <m.j.hutchinson@gmail.com>2013-06-20 02:37:14 +0400
commit0bb971d513368fd0912f90e1ea32790eb0e22fd0 (patch)
treec3929d4d14e30aaf754e1ef4b64a5a1b0bc46458 /mcs/class/Mono.Cairo
parent9ce4c0db33de2e73901a685eb9c34a7ed8a72154 (diff)
Make debug more robust
Diffstat (limited to 'mcs/class/Mono.Cairo')
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs b/mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs
index ea156793172..43b370f8b06 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs
@@ -50,7 +50,7 @@ namespace Cairo {
if (!Enabled)
throw new InvalidOperationException ();
- traces.Add (obj, Environment.StackTrace);
+ traces[obj] = Environment.StackTrace;
}
public static void OnDisposed<T> (IntPtr obj, bool disposing)
@@ -61,8 +61,11 @@ namespace Cairo {
if (!disposing) {
Console.Error.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
if (Enabled) {
- Console.Error.WriteLine ("Allocated from:");
- Console.Error.WriteLine (traces[obj]);
+ string val;
+ if (traces.TryGetValue (obj, out val)) {
+ Console.Error.WriteLine ("Allocated from:");
+ Console.Error.WriteLine (val);
+ }
} else {
Console.Error.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
}