GAsyncQueue: assert non-null data in push_sorted()

While working on
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4648
I realized there is no assertion checking the data argument in either
g_async_queue_push_sorted() or g_async_queue_push_sorted_unlocked().

All the other push functions assert that data is not null, and the
argument is even marked as not nullable in g_async_queue_push_sorted(),
so this is clearly an oversight.

This patch adds the assert in the _unlocked() version, so that it
applies to both.

I have consciously separated this change from the other merge request,
since that one only makes documentation changes, whereas adding an
assert is a subtle change in behavior that could potentially show as
a regression in buggy applications.
This commit is contained in:
Alicia Boya García 2025-05-24 16:37:32 +02:00
parent 7b996a6ce5
commit 8dc4df894e

View File

@ -347,6 +347,7 @@ g_async_queue_push_sorted_unlocked (GAsyncQueue *queue,
SortData sd;
g_return_if_fail (queue != NULL);
g_return_if_fail (data != NULL);
sd.func = func;
sd.user_data = user_data;