mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-28 07:06:04 +00:00
Run-time check values before doing bad computation
This commit is contained in:
parent
560767b573
commit
02b326f80b
@ -403,6 +403,10 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
|
||||
DEBUG_LOG("Allocated %dx%d", allocation->width, allocation->height);
|
||||
gtk_widget_set_allocation(widget, allocation);
|
||||
|
||||
if (priv->desktopWidth == 0 ||
|
||||
priv->desktopHeight == 0)
|
||||
goto end;
|
||||
|
||||
desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight;
|
||||
|
||||
if (child && gtk_widget_get_visible(child)) {
|
||||
@ -427,7 +431,7 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
|
||||
gtk_widget_size_allocate(child, &child_allocation);
|
||||
}
|
||||
|
||||
|
||||
end:
|
||||
/* This unsets the size request, so that the user can
|
||||
* manually resize the window smaller again
|
||||
*/
|
||||
|
||||
@ -433,6 +433,11 @@ virt_viewer_window_resize(VirtViewerWindow *self)
|
||||
(screen, gtk_widget_get_window(priv->window)),
|
||||
&fullscreen);
|
||||
|
||||
g_return_if_fail(fullscreen.height > 128);
|
||||
g_return_if_fail(fullscreen.width > 128);
|
||||
g_return_if_fail(desktopWidth > 0);
|
||||
g_return_if_fail(desktopHeight > 0);
|
||||
|
||||
desktopAspect = (double)desktopWidth / (double)desktopHeight;
|
||||
screenAspect = (double)(fullscreen.width - 128) / (double)(fullscreen.height - 128);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user