diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index 2e7e193..8c5c3f5 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -1730,7 +1730,6 @@ virt_viewer_app_init(VirtViewerApp *self) g_clear_error(&error); - self->priv->initial_display_map = virt_viewer_app_get_monitor_mapping_for_section(self, "fallback"); g_signal_connect(self, "notify::guest-name", G_CALLBACK(title_maybe_changed), NULL); g_signal_connect(self, "notify::title", G_CALLBACK(title_maybe_changed), NULL); g_signal_connect(self, "notify::guri", G_CALLBACK(title_maybe_changed), NULL); @@ -1807,6 +1806,7 @@ virt_viewer_app_on_application_startup(GApplication *app) self->priv->main_window = virt_viewer_app_window_new(self, virt_viewer_app_get_first_monitor(self)); self->priv->main_notebook = GTK_WIDGET(virt_viewer_window_get_notebook(self->priv->main_window)); + self->priv->initial_display_map = virt_viewer_app_get_monitor_mapping_for_section(self, "fallback"); virt_viewer_app_set_kiosk(self, opt_kiosk); virt_viewer_app_set_hotkeys(self, opt_hotkeys); diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c index 0491f73..6b63133 100644 --- a/src/virt-viewer-util.c +++ b/src/virt-viewer-util.c @@ -641,11 +641,14 @@ virt_viewer_shift_monitors_to_origin(GHashTable *displays) GHashTable* virt_viewer_parse_monitor_mappings(gchar **mappings, const gsize nmappings, const gint nmonitors) { - GHashTable *displaymap = g_hash_table_new(g_direct_hash, g_direct_equal); - GHashTable *monitormap = g_hash_table_new(g_direct_hash, g_direct_equal); + GHashTable *displaymap; + GHashTable *monitormap; gint i, max_display_id = 0; gchar **tokens = NULL; + g_return_val_if_fail(nmonitors != 0, NULL); + displaymap = g_hash_table_new(g_direct_hash, g_direct_equal); + monitormap = g_hash_table_new(g_direct_hash, g_direct_equal); if (nmappings == 0) { g_warning("Empty monitor-mapping configuration"); goto configerror;