[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [virt-viewer v2] vnc: Clear all displays before creating dummy display



If VirtViewerSessionVnc::disconnected is called because of an
authentication failure, we get:

(remote-viewer:29588): gtk-vnc-DEBUG: vncdisplay.c Disconnected from VNC server

(remote-viewer:29588): Gtk-WARNING **: Attempting to add a widget with type
VncDisplay to a container of type VirtViewerDisplayVnc, but the widget is
already inside a container of type VirtViewerDisplayVnc, please use
gtk_widget_reparent()

 #0  0x0000003136e50499 in g_logv (log_domain=0x3f2e13e143 "Gtk",
     log_level=G_LOG_LEVEL_WARNING, format=<optimized out>,
     args=args entry=0x7fffffffd210) at gmessages.c:989
 #1  0x0000003136e505ef in g_log (log_domain=<optimized out>, log_level=<optimized out>,
     format=<optimized out>) at gmessages.c:1025
 #2  0x00000000004230eb in virt_viewer_display_vnc_new (vnc=0x8a8250)
     at virt-viewer-display-vnc.c:169
 #3  0x0000000000422191 in virt_viewer_session_vnc_disconnected (vnc=0x8a8250,
     session=0x86bf00) at virt-viewer-session-vnc.c:113
 #4  0x00000031372104c7 in _g_closure_invoke_va (closure=closure entry=0x8ad2b0,
     return_value=return_value entry=0x0, instance=instance entry=0x8a8250,
     args=args entry=0x7fffffffd530, n_params=0, param_types=0x0) at gclosure.c:840
 #5  0x0000003137229749 in g_signal_emit_valist (instance=0x8a8250,
     signal_id=<optimized out>, detail=0, var_args=var_args entry=0x7fffffffd530)
     at gsignal.c:3238
 #6  0x000000313722a3af in g_signal_emit (instance=<optimized out>,
     signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
 #7  0x00007ffff7dbeb5a in on_disconnected (conn=0x8b5aa0, opaque=0x8a8250)
     at vncdisplay.c:1563
 #8  0x00000031372104c7 in _g_closure_invoke_va (closure=closure entry=0x7d55f0,
     return_value=return_value entry=0x0, instance=instance entry=0x8b5aa0,
     args=args entry=0x7fffffffd820, n_params=0, param_types=0x0) at gclosure.c:840
 #9  0x0000003137229749 in g_signal_emit_valist (instance=0x8b5aa0,
     signal_id=<optimized out>, detail=0, var_args=var_args entry=0x7fffffffd820)
     at gsignal.c:3238
 #10 0x000000313722a3af in g_signal_emit (instance=<optimized out>,
     signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
 #11 0x00007ffff7b97308 in do_vnc_connection_emit_main_context (opaque=0x7fffe3c91f40)
     at vncconnection.c:578
 #12 0x0000003136e49256 in g_main_dispatch (context=0x681840) at gmain.c:3065
 #13 g_main_context_dispatch (context=context entry=0x681840) at gmain.c:3641
 #14 0x0000003136e495d8 in g_main_context_iterate (context=0x681840,
     block=block entry=1, dispatch=dispatch entry=1, self=<optimized out>)
     at gmain.c:3712
 #15 0x0000003136e499ea in g_main_loop_run (loop=0x830430) at gmain.c:3906
 #16 0x0000003f2dfa8f75 in gtk_main () at gtkmain.c:1158
 #17 0x0000000000429bf3 in main (argc=1, argv=0x7fffffffdcd8) at remote-viewer-main.c:179

This commit calls virt_viewer_session_clear_displays() before creating a dummy VNC display with
virt_viewer_display_vnc_new(), which avoids this warning.
---

Changes since v1:
  - fix backtrace in commit message (lines should not start with # ...)
  - remove if (..->vnc != NULL) test


 src/virt-viewer-session-vnc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
index 05e98c8..50fa11f 100644
--- a/src/virt-viewer-session-vnc.c
+++ b/src/virt-viewer-session-vnc.c
@@ -110,7 +110,10 @@ static void
 virt_viewer_session_vnc_disconnected(VncDisplay *vnc G_GNUC_UNUSED,
                                      VirtViewerSessionVnc *session)
 {
-    GtkWidget *display = virt_viewer_display_vnc_new(session->priv->vnc);
+    GtkWidget *display;
+
+    virt_viewer_session_clear_displays(VIRT_VIEWER_SESSION(session));
+    display = virt_viewer_display_vnc_new(session->priv->vnc);
     DEBUG_LOG("Disconnected");
     g_signal_emit_by_name(session, "session-disconnected");
     virt_viewer_display_set_show_hint(VIRT_VIEWER_DISPLAY(display),
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]