mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 10:42:11 +01:00
gmain: Go back to using the standard unref logic if the final unref failed
If going from 1 -> 0 references failed, then we should restart the unref process, by potentially re-entering in the dispose function again if instead something else re-references us and we're going to drop the last one again.
This commit is contained in:
parent
7b61cc8277
commit
6052374c78
@ -2255,12 +2255,13 @@ retry_beginning:
|
||||
/* At this point the source can have been revived by any of the threads
|
||||
* acting on it or it's really ready for being finalized.
|
||||
*/
|
||||
if (!g_atomic_int_dec_and_test (&source->ref_count))
|
||||
if (!g_atomic_int_compare_and_exchange_full ((int *) &source->ref_count,
|
||||
1, 0, &old_ref))
|
||||
{
|
||||
if (!have_lock && context)
|
||||
UNLOCK_CONTEXT (context);
|
||||
|
||||
return;
|
||||
goto retry_beginning;
|
||||
}
|
||||
|
||||
TRACE (GLIB_SOURCE_BEFORE_FREE (source, context,
|
||||
|
Loading…
x
Reference in New Issue
Block a user