If the query has already been destroyed at this point, GST_IS_QUERY will read garbage, can return false and we will try to unref it again. Instead, make note of whether the item is a query when we dequeue it. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1029>