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>
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.