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:
parent
b75e7c82b6
commit
08f4ae2eb4
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue