Only use toggle references for GObjects that hold a reterence to a D
object.
Mike Wey
5 years ago
461 | 461 | isGcRoot = false; |
462 | 462 | } |
463 | 463 | |
464 | g_object_remove_toggle_ref(gObject, cast(GToggleNotify)&toggleNotify, cast(void*)this); | |
464 | // We only have a toggle ref if the C object hods a reference to the D object. | |
465 | if ( g_object_get_data(gObject, cast(char*)"GObject") is cast(void*)this ) | |
466 | g_object_remove_toggle_ref(gObject, cast(GToggleNotify)&toggleNotify, cast(void*)this); | |
467 | else | |
468 | g_object_unref(gObject); | |
465 | 469 | } |
466 | 470 | } |
467 | 471 | |
592 | 596 | p[0..ci.initializer.length] = ci.initializer; |
593 | 597 | iface = cast(Impl)p; |
594 | 598 | iface.gObject = instance; |
595 | iface.addToggleRef(cast(GToggleNotify)&toggleNotify, cast(void*)iface); | |
599 | iface.doref(); | |
596 | 600 | |
597 | 601 | return iface; |
598 | 602 | } |