+(defmethod initialize-proxy ((object gobject) &rest initargs &key weak-ref)
+ (declare (ignore initargs))
+ (call-next-method)
+ (%object-weak-ref object)
+ (unless weak-ref
+ (object-ref object)))
+
+(def-callback weak-notify (void (data int) (location system-area-pointer))
+ (when (instance-cached-p location)
+ (warn "~A being finalized by the GObject system while still in existence in lisp" (find-cached-instance location))
+ (remove-cached-instance location)))
+
+(defbinding %object-weak-ref (object) nil
+ (object gobject)
+ ((callback weak-notify) pointer)
+ (0 unsigned-int))
+