Commit Graph

5 Commits

Author SHA1 Message Date
Andrés G. Aragoneses
70d1827058 cairo: Throw ObjectDisposedException after an object has been disposed
Potentially all these IDisposable classes could be used after being
disposed, which would result in native crashes. We now do an explicit
check and throw an exception in managed land when the object has been
disposed.

This is particularly useful because:
 a/ the native crashes are quite obscure, there no indication that
you're using a disposed object
 b/ Gtk# is passing Context instances to user methods, and disposes them
when the method returns. So if the user code keeps a reference to the
Context, there a good chance it will try to use it after it's disposed.

Other changes in this patch include:
 * Renaming a parameter to be more consistent with the other subsequent
ctor called.
 * Replacing implementation of some [Obsolete()] methods with the call
to the methods they were replaced with, to avoid redundancy and the
need for more CheckDisposed() calls than necessary.
 * Throw ArgumentException when receiving an IntPtr.Zero as a handle,
as a way to protect ourselves from wrapping invalid native pointers,
and throwing ObjectDisposedExceptions because the object was invalid in
the first place.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-11-24 15:56:26 +01:00
Michael Hutchinson
38d1a3f13e cairo: Introduce the concept of reference ownership
Also:
  * improving naming consistency
  * obsolete old/broken stuff
  * clean up tabs/space mix

NOTE: this removes the wrapper caches for Pattern and Surface as
there was no reliable way to clear them.

This is a merge from changes in Mono.Cairo in mono 3.2.
2013-07-26 17:43:11 -05:00
Mike Kestner
6647c2609c Revert a couple files to mono master
* cairo/Cairo.cs: make a static class like master
* cairo/ImageSurface.cs: revert obsolete warning and ws changes
2011-04-21 18:01:33 -05:00
Mike Kestner
ee866216b1 Cairo API 1.10 updates.
* cairo/*: merge changes to Mono.Cairo since we split back in Oct 2008.
  Not much changed.  Scrubbed the doc index and updated NativeMethods
  to match.  Commented with DONTCARE the ones we will ignore.  Implemented
  a few of them, including an initial Device binding.  Still some work
  to do, and some discovery to be done to see what happened to Xcb, Glitz,
  and DirectFB surfaces and whether we need to remove those classes.
2011-02-17 23:00:12 -06:00
Mike Kestner
b20d37c79c 2008-10-09 Mike Kestner <mkestner@novell.com>
* cairo/*.cs: flatten source hierarchy to simplify win32 build.
	* sample/Makefile.am: fix a ref issue with local cairo.

svn path=/trunk/gtk-sharp/; revision=115401
2008-10-09 23:53:18 +00:00