Source.setDisposeFunction

Set dispose as dispose function on source. dispose will be called once the reference count of source reaches 0 but before any of the state of the source is freed, especially before the finalize function is called.

This means that at this point source is still a valid glib.Source and it is allow for the reference count to increase again until dispose returns.

The dispose function can be used to clear any "weak" references to the source in other data structures in a thread-safe way where it is possible for another thread to increase the reference count of source again while it is being freed.

The finalize function can not be used for this purpose as at that point source is already partially freed and not valid anymore.

This should only ever be called from glib.Source implementations.

class Source
void
setDisposeFunction

Parameters

dispose GSourceDisposeFunc

GSourceDisposeFunc to set on the source

Meta

Since

2.64