Package: glib
Function g-source-is-destroyed
Lambda Listg-source-is-destroyed (source) ArgumentsReturn ValueTrue if source has been destroyed. Details
Returns whether the source has been destroyed.
This is important when you operate upon your objects from within idle
handlers, but may have freed the object before the dispatch of your idle
handler.
static gboolean
idle_callback (gpointer data)
{
SomeWidget *self = data;
This will fail in a multi-threaded application if the widget is destroyed
before the idle handler fires due to the use after free in the callback
function. A solution, to this particular problem, is to check to if the
source has already been destroy within the callback function.
static gboolean
idle_callback (gpointer data)
{
SomeWidget *self = data; | See also |
2021-12-10