mirror of
https://gitlab.gnome.org/GNOME/libmks.git
synced 2024-12-22 13:45:21 +00:00
dmabuf: Avoid division by 0
When opening mks for an already running VM, the QEMU dbus backend has no way to tell to the VM refresh the display and submit a new UpdateDMABuf. So by the time size_allocate is called, the height and width of the paintable are still set to 0. This should fix the size allocate warning we see now until we figure out a proper fix from the QEMU side.
This commit is contained in:
parent
9334cd4ee9
commit
4f08953fb0
@ -97,7 +97,10 @@ mks_dmabuf_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
|||||||
{
|
{
|
||||||
MksDmabufPaintable *self = MKS_DMABUF_PAINTABLE (paintable);
|
MksDmabufPaintable *self = MKS_DMABUF_PAINTABLE (paintable);
|
||||||
|
|
||||||
|
if (self->height != 0)
|
||||||
return (double)self->width / (double)self->height;
|
return (double)self->width / (double)self->height;
|
||||||
|
else
|
||||||
|
return 0.;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user