Commit 7e0471a5 authored by Mike Wey's avatar Mike Wey

Only use toggle references for GObjects that hold a reterence to a D

object.
parent 627256d9
......@@ -151,7 +151,11 @@ public class ObjectG
isGcRoot = false;
}
g_object_remove_toggle_ref(gObject, cast(GToggleNotify)&toggleNotify, cast(void*)this);
// We only have a toggle ref if the C object hods a reference to the D object.
if ( g_object_get_data(gObject, cast(char*)"GObject") is cast(void*)this )
g_object_remove_toggle_ref(gObject, cast(GToggleNotify)&toggleNotify, cast(void*)this);
else
g_object_unref(gObject);
}
}
......@@ -282,7 +286,7 @@ public class ObjectG
p[0..ci.initializer.length] = ci.initializer;
iface = cast(Impl)p;
iface.gObject = instance;
iface.addToggleRef(cast(GToggleNotify)&toggleNotify, cast(void*)iface);
iface.doref();
return iface;
}
......
......@@ -462,7 +462,11 @@ code: start
isGcRoot = false;
}
g_object_remove_toggle_ref(gObject, cast(GToggleNotify)&toggleNotify, cast(void*)this);
// We only have a toggle ref if the C object hods a reference to the D object.
if ( g_object_get_data(gObject, cast(char*)"GObject") is cast(void*)this )
g_object_remove_toggle_ref(gObject, cast(GToggleNotify)&toggleNotify, cast(void*)this);
else
g_object_unref(gObject);
}
}
......@@ -593,7 +597,7 @@ code: start
p[0..ci.initializer.length] = ci.initializer;
iface = cast(Impl)p;
iface.gObject = instance;
iface.addToggleRef(cast(GToggleNotify)&toggleNotify, cast(void*)iface);
iface.doref();
return iface;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment