onscreen/native: Check frame_info for null in finish frame callback
While adjusting the monitor layout of my docked laptop, mutter got a
segfault while attempting to dereference the frame_info struct. This
happened on gnome-shell 44.4-1.fc38.
cogl_onscreen_peek_head_frame_info() just forwards the call to
g_queue_peek_head() which returns NULL in the event that the queue is
empty. If finish_frame_result_feedback() is expected to always be called
with a non-empty queue there's still a bug somewhere, but regardless
this API can legitimately return NULL so it should be checked for prior
to dereferencing.
Fixes: 61801a713a
("onscreen/native: Avoid freezing the frame clock on failed cursor commits")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3229>
This commit is contained in:
parent
fb640783e8
commit
379996a63e
@ -1530,6 +1530,12 @@ finish_frame_result_feedback (const MetaKmsFeedback *kms_feedback,
|
|||||||
g_warning ("Cursor update failed: %s", error->message);
|
g_warning ("Cursor update failed: %s", error->message);
|
||||||
|
|
||||||
frame_info = cogl_onscreen_peek_head_frame_info (onscreen);
|
frame_info = cogl_onscreen_peek_head_frame_info (onscreen);
|
||||||
|
if (!frame_info)
|
||||||
|
{
|
||||||
|
g_warning ("The feedback callback was called, but there was no frame info");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
|
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
|
||||||
|
|
||||||
meta_onscreen_native_notify_frame_complete (onscreen);
|
meta_onscreen_native_notify_frame_complete (onscreen);
|
||||||
|
Loading…
Reference in New Issue
Block a user