Running remote-viewer will throw some warnings:
(remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_app_menu:
assertion 'GTK_IS_APPLICATION (application)' failed
(remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_menubar:
assertion 'GTK_IS_APPLICATION (application)' failed
This does not happen with virt-viewer. I attached the gdb backtrace to
this mail.
On 02/12/2016 09:35 AM, Eduardo Lima (Etrunko) wrote:
[snip]
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 653b30c..5b0e720 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -1868,25 +1867,81 @@ virt_viewer_app_constructed(GObject *object)
> gtk_accel_map_add_entry("<virt-viewer>/view/zoom-out", GDK_minus,
> GDK_CONTROL_MASK);
> gtk_accel_map_add_entry("<virt-viewer>/view/zoom-in", GDK_plus,
> GDK_CONTROL_MASK);
> gtk_accel_map_add_entry("<virt-viewer>/send/secure-attention", GDK_End,
> GDK_CONTROL_MASK | GDK_MOD1_MASK);
> +
> + if (!virt_viewer_app_start(self, &error)) {
> + if (error && !g_error_matches(error, VIRT_VIEWER_ERROR,
> VIRT_VIEWER_ERROR_CANCELLED)) {
> + virt_viewer_app_simple_message_dialog(self, error->message);
> + }
> +
> + g_clear_error(&error);
> + g_application_quit(app);
> + }
> +
> + g_application_hold(app);
Again, this call to _hold() is only necessary for remote-viewer,
otherwise the application will quit the mainloop before showing the main
window. This is not necessary for virt-viewer, and I tried to track the
reason, without success. Maybe someone can help here.
> +}
> +
> +static gboolean
> +virt_viewer_app_local_command_line (GApplication *gapp,
> + gchar ***args,
> + int *status)
> +{
> + VirtViewerApp *self = VIRT_VIEWER_APP(gapp);
> + gboolean ret = FALSE;
> + gint argc = g_strv_length(*args);
> + GError *error = NULL;
> + GOptionContext *context = g_option_context_new(NULL);
> + GOptionGroup *group = g_option_group_new("virt-viewer", NULL, NULL,
> NULL, NULL);
> +
> + g_option_context_set_main_group(context, group);
> + VIRT_VIEWER_APP_GET_CLASS(self)->add_option_entries(self, context,
> group);
> +
> + g_option_context_add_group(context, gtk_get_option_group(TRUE));
> +
> +#ifdef HAVE_GTK_VNC
> + g_option_context_add_group(context, vnc_display_get_option_group());
> +#endif
> +
> +#ifdef HAVE_SPICE_GTK
> + g_option_context_add_group(context, spice_get_option_group());
> +#endif
> +
> + if (!g_option_context_parse(context, &argc, args, &error))
> + {
> + if (error && !g_error_matches(error, VIRT_VIEWER_ERROR,
> VIRT_VIEWER_VERSION)) {
> + g_printerr(_("%s\n"), error->message);
> + *status = 1;
> + }
> +
> + g_error_free(error);
> + ret = TRUE;
> + }
> +
> + g_option_context_free(context);
> + return ret;
> }
>
> static void
> virt_viewer_app_class_init (VirtViewerAppClass *klass)
> {
> GObjectClass *object_class = G_OBJECT_CLASS (klass);
> + GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
>
> g_type_class_add_private (klass, sizeof (VirtViewerAppPrivate));
>
> - object_class->constructed = virt_viewer_app_constructed;
> object_class->get_property = virt_viewer_app_get_property;
> object_class->set_property = virt_viewer_app_set_property;
> object_class->dispose = virt_viewer_app_dispose;
>
> + g_app_class->local_command_line = virt_viewer_app_local_command_line;
> + g_app_class->startup = virt_viewer_app_startup;
> + g_app_class->command_line = NULL; /* inhibit GApplication default
> handler */
> +
In this case we set the handler to NULL to avoid some warnings that will
be thrown by the default handler. We could have defined a function which
did nothing, as all command line options were already handled in
local_command_line().
--
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
[email protected]
Breakpoint 1, gtk_application_get_app_menu (application=0x0) at
gtkapplication.c:1102
warning: Source file is more recent than executable.
1102
Missing separate debuginfos, use: dnf debuginfo-install
bzip2-libs-1.0.6-19.fc23.x86_64 libgcc-5.3.1-2.fc23.x86_64
(gdb) bt
#0 gtk_application_get_app_menu (application=0x0) at gtkapplication.c:1102
#1 0x00007ffff6c0e751 in gtk_application_window_update_shell_shows_app_menu
(window=0x6d6270, settings=<optimized out>) at gtkapplicationwindow.c:319
#2 0x00007ffff6c0e8e3 in gtk_application_window_real_realize (widget=0x6d6270)
at gtkapplicationwindow.c:752
#3 0x00007ffff4480ad4 in _g_closure_invoke_va (closure=closure@entry=0x659210,
return_value=return_value@entry=0x0, instance=instance@entry=0x6d6270,
args=args@entry=0x7fffffffcfe8, n_params=<optimized out>, param_types=0x0) at
gclosure.c:840
#4 0x00007ffff449aa1d in g_signal_emit_valist (instance=0x6d6270,
signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffcfe8) at
gsignal.c:3238
#5 0x00007ffff449b002 in g_signal_emit (instance=instance@entry=0x6d6270,
signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3386
#6 0x00007ffff6e269b8 in gtk_widget_realize (widget=widget@entry=0x6d6270) at
gtkwidget.c:4994
#7 0x00007ffff6e32668 in gtk_window_show (widget=0x6d6270) at gtkwindow.c:5442
#8 0x00007ffff44808a5 in g_closure_invoke (closure=closure@entry=0x6585e0,
return_value=return_value@entry=0x0, n_param_values=1,
param_values=param_values@entry=0x7fffffffd3a0,
invocation_hint=invocation_hint@entry=0x7fffffffd340) at gclosure.c:777
#9 0x00007ffff4491efc in signal_emit_unlocked_R (node=node@entry=0x658630,
detail=detail@entry=0, instance=instance@entry=0x6d6270,
emission_return=emission_return@entry=0x0,
instance_and_params=instance_and_params@entry=0x7fffffffd3a0) at gsignal.c:3516
#10 0x00007ffff449ad34 in g_signal_emit_valist (instance=<optimized out>,
signal_id=<optimized out>, detail=<optimized out>,
var_args=var_args@entry=0x7fffffffd538) at gsignal.c:3330
#11 0x00007ffff449b002 in g_signal_emit (instance=instance@entry=0x6d6270,
signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3386
#12 0x00007ffff6e23fec in gtk_widget_show (widget=0x6d6270) at gtkwidget.c:4336
#13 0x00000000004201c1 in virt_viewer_window_show (self=0x6ba120) at
virt-viewer-window.c:1357
#14 0x0000000000413320 in virt_viewer_app_default_start (self=<optimized out>,
error=<optimized out>) at virt-viewer-app.c:1723
#15 0x0000000000410d84 in remote_viewer_start (app=0x650220,
err=0x7fffffffd6f8) at remote-viewer.c:1216
#16 0x0000000000416259 in virt_viewer_app_start (self=self@entry=0x650220,
error=error@entry=0x7fffffffd6f8) at virt-viewer-app.c:1736
#17 0x0000000000416cab in virt_viewer_app_startup (app=0x650220) at
virt-viewer-app.c:1871
#18 0x00007ffff4480ad4 in _g_closure_invoke_va (closure=closure@entry=0x64aba0,
return_value=return_value@entry=0x0, instance=instance@entry=0x650220,
args=args@entry=0x7fffffffd978, n_params=<optimized out>, param_types=0x0) at
gclosure.c:840
#19 0x00007ffff449aa1d in g_signal_emit_valist (instance=0x650220,
signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd978) at
gsignal.c:3238
#20 0x00007ffff449b002 in g_signal_emit (instance=instance@entry=0x650220,
signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3386
#21 0x00007ffff4d9cf42 in g_application_register
(application=application@entry=0x650220, cancellable=cancellable@entry=0x0,
error=error@entry=0x7fffffffda98) at gapplication.c:1316
#22 0x00007ffff4d9d592 in g_application_run (application=0x650220,
argc=argc@entry=1, argv=argv@entry=0x7fffffffdbe8) at gapplication.c:1589
#23 0x000000000040f759 in main (argc=1, argv=0x7fffffffdbe8) at
remote-viewer-main.c:44
(gdb) c
Continuing.
(remote-viewer:570): Gtk-CRITICAL **: gtk_application_get_app_menu: assertion
'GTK_IS_APPLICATION (application)' failed
Breakpoint 2, gtk_application_get_menubar (application=0x0) at
gtkapplication.c:1176
1176
(gdb) bt
#0 gtk_application_get_menubar (application=0x0) at gtkapplication.c:1176
#1 0x00007ffff6c0e689 in gtk_application_window_update_shell_shows_menubar
(window=0x6d6270, settings=<optimized out>) at gtkapplicationwindow.c:368
#2 0x00007ffff6c0e8ee in gtk_application_window_real_realize (widget=0x6d6270)
at gtkapplicationwindow.c:753
#3 0x00007ffff4480ad4 in _g_closure_invoke_va (closure=closure@entry=0x659210,
return_value=return_value@entry=0x0, instance=instance@entry=0x6d6270,
args=args@entry=0x7fffffffcfe8, n_params=<optimized out>, param_types=0x0) at
gclosure.c:840
#4 0x00007ffff449aa1d in g_signal_emit_valist (instance=0x6d6270,
signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffcfe8) at
gsignal.c:3238
#5 0x00007ffff449b002 in g_signal_emit (instance=instance@entry=0x6d6270,
signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3386
#6 0x00007ffff6e269b8 in gtk_widget_realize (widget=widget@entry=0x6d6270) at
gtkwidget.c:4994
#7 0x00007ffff6e32668 in gtk_window_show (widget=0x6d6270) at gtkwindow.c:5442
#8 0x00007ffff44808a5 in g_closure_invoke (closure=closure@entry=0x6585e0,
return_value=return_value@entry=0x0, n_param_values=1,
param_values=param_values@entry=0x7fffffffd3a0,
invocation_hint=invocation_hint@entry=0x7fffffffd340) at gclosure.c:777
#9 0x00007ffff4491efc in signal_emit_unlocked_R (node=node@entry=0x658630,
detail=detail@entry=0, instance=instance@entry=0x6d6270,
emission_return=emission_return@entry=0x0,
instance_and_params=instance_and_params@entry=0x7fffffffd3a0) at gsignal.c:3516
#10 0x00007ffff449ad34 in g_signal_emit_valist (instance=<optimized out>,
signal_id=<optimized out>, detail=<optimized out>,
var_args=var_args@entry=0x7fffffffd538) at gsignal.c:3330
#11 0x00007ffff449b002 in g_signal_emit (instance=instance@entry=0x6d6270,
signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3386
#12 0x00007ffff6e23fec in gtk_widget_show (widget=0x6d6270) at gtkwidget.c:4336
#13 0x00000000004201c1 in virt_viewer_window_show (self=0x6ba120) at
virt-viewer-window.c:1357
#14 0x0000000000413320 in virt_viewer_app_default_start (self=<optimized out>,
error=<optimized out>) at virt-viewer-app.c:1723
#15 0x0000000000410d84 in remote_viewer_start (app=0x650220,
err=0x7fffffffd6f8) at remote-viewer.c:1216
#16 0x0000000000416259 in virt_viewer_app_start (self=self@entry=0x650220,
error=error@entry=0x7fffffffd6f8) at virt-viewer-app.c:1736
#17 0x0000000000416cab in virt_viewer_app_startup (app=0x650220) at
virt-viewer-app.c:1871
#18 0x00007ffff4480ad4 in _g_closure_invoke_va (closure=closure@entry=0x64aba0,
return_value=return_value@entry=0x0, instance=instance@entry=0x650220,
args=args@entry=0x7fffffffd978, n_params=<optimized out>, param_types=0x0) at
gclosure.c:840
#19 0x00007ffff449aa1d in g_signal_emit_valist (instance=0x650220,
signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd978) at
gsignal.c:3238
#20 0x00007ffff449b002 in g_signal_emit (instance=instance@entry=0x650220,
signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3386
#21 0x00007ffff4d9cf42 in g_application_register
(application=application@entry=0x650220, cancellable=cancellable@entry=0x0,
error=error@entry=0x7fffffffda98) at gapplication.c:1316
#22 0x00007ffff4d9d592 in g_application_run (application=0x650220,
argc=argc@entry=1, argv=argv@entry=0x7fffffffdbe8) at gapplication.c:1589
#23 0x000000000040f759 in main (argc=1, argv=0x7fffffffdbe8) at
remote-viewer-main.c:44
(gdb)
_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list