screen-cast/stream: Pass redraw clip to stage watches instead of paint context

The virtual stream source with CURSOR_MODE_EMBEDDED uses
META_STAGE_WATCH_AFTER_PAINT as the callback for recording its frame. In
this stage of the paint though, there is no ClutterPaintContext anymore
(there only is a paint context during the paint, not afterwards).
The callback (actors_painted()) tries to get the redraw clip from the paint
context, and we end up with a NULL pointer crash.

We actually do still have a redraw clip at this point, so because everyone
uses the paint context to get the redraw clip anyway, just pass the redraw
clip to the stage watches directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3283>
This commit is contained in:
Jonas Dreßler
2023-09-15 18:54:37 +02:00
committed by Robert Mader
parent 03a5699abd
commit c4b9431bb2
6 changed files with 46 additions and 48 deletions

View File

@ -270,11 +270,11 @@ typedef struct
} CaptureViewData;
static void
on_after_paint (MetaStage *stage,
ClutterStageView *view,
ClutterPaintContext *paint_context,
ClutterFrame *frame,
gpointer user_data)
on_after_paint (MetaStage *stage,
ClutterStageView *view,
const cairo_region_t *redraw_clip,
ClutterFrame *frame,
gpointer user_data)
{
CaptureViewData *data = user_data;
MtkRectangle rect;