Package org.gnome.gobject
Interface WeakNotify
- All Superinterfaces:
FunctionPointer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
@Generated("io.github.jwharm.JavaGI")
public interface WeakNotify
extends FunctionPointer
Functional interface declaration of the
WeakNotify callback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidrun(@Nullable MemorySegment data, GObject whereTheObjectWas) AGWeakNotifyfunction can be added to an object as a callback that gets triggered when the object is finalized.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)method.default voidupcall(MemorySegment data, MemorySegment whereTheObjectWas) Theupcallmethod is called from native code.
-
Method Details
-
run
AGWeakNotifyfunction can be added to an object as a callback that gets triggered when the object is finalized.Since the object is already being disposed when the
GWeakNotifyis called, there's not much you could do with the object, apart from e.g. using its address as hash-index or the like.In particular, this means it’s invalid to call g_object_ref(), g_weak_ref_init(), g_weak_ref_set(), g_object_add_toggle_ref(), g_object_weak_ref(), g_object_add_weak_pointer() or any function which calls them on the object from this callback.
-
upcall
Theupcallmethod is called from native code. The parameters are marshaled andrun(java.lang.foreign.MemorySegment, org.gnome.gobject.GObject)is executed. -
toCallback
Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-