Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
cairo: fix leak when Context object is finalized
Browse files Browse the repository at this point in the history
When the finalizer calls Dispose(), disposing is false, it means that
CairoDebug traces should be printed, but the reference count on the
native context should still be decreased. Otherwise a real leak
would appear, as the native context would never be freed when the
managed object is GCed.
  • Loading branch information
knocte authored and bl8 committed Nov 3, 2013
1 parent fc97460 commit 41eeecb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cairo/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected virtual void Dispose (bool disposing)
if (!disposing || CairoDebug.Enabled)
CairoDebug.OnDisposed<Context> (handle, disposing);

if (!disposing || handle == IntPtr.Zero)
if (handle == IntPtr.Zero)
return;

NativeMethods.cairo_destroy (handle);
Expand Down

0 comments on commit 41eeecb

Please sign in to comment.