glib: Check for self-assignment of Opaque.Raw property

This avoids unnecessary work, and prevents the IntPtr from being
freed when assigned to itself.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
This commit is contained in:
Master T 2014-09-18 04:03:25 +02:00 committed by Bertrand Lorentz
parent b75e7c82b6
commit 08f4ae2eb4

View file

@ -67,6 +67,10 @@ namespace GLib {
return _obj; return _obj;
} }
set { set {
if (_obj == value) {
return;
}
if (_obj != IntPtr.Zero) { if (_obj != IntPtr.Zero) {
Unref (_obj); Unref (_obj);
if (owned) if (owned)