gpu: Don't crash when there's no ops

In the rare situation (read: I triggered it with obscure hacks) where no
ops are emitted, we could end up pointing into invalid memory and
crashing.

Don't do that.
This commit is contained in:
Benjamin Otte 2024-09-10 15:04:01 +02:00
parent 9690c87736
commit e35670a014

View File

@ -74,6 +74,7 @@ gsk_gpu_frame_default_cleanup (GskGpuFrame *self)
}
gsk_gpu_ops_set_size (&priv->ops, 0);
priv->first_op = NULL;
priv->last_op = NULL;
}
@ -283,6 +284,9 @@ gsk_gpu_frame_seal_ops (GskGpuFrame *self)
GskGpuOp *last, *op;
gsize i;
if (gsk_gpu_ops_get_size (&priv->ops) == 0)
return;
priv->first_op = (GskGpuOp *) gsk_gpu_ops_index (&priv->ops, 0);
last = priv->first_op;