[virt-tools-list] [PATCH virt-viewer 3/4] Fix a floating display warning

Marc-André Lureau marcandre.lureau at gmail.com
Tue Jun 10 12:18:10 UTC 2014


From: Marc-André Lureau <marcandre.lureau at redhat.com>

(virt-viewer:7262): Gtk-WARNING **: A floating object was finalized. This means that someone
called g_object_unref() on an object that had only a floating
reference; the initial floating reference is not owned by anyone
and must be removed with g_object_ref_sink().

That g_object_unref() was probably the wrong way to get rid of the floating ref.

https://bugzilla.redhat.com/show_bug.cgi?id=1107518
---
 src/virt-viewer-app.c     | 1 -
 src/virt-viewer-session.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index b952faf..6c87c30 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -844,7 +844,6 @@ virt_viewer_app_display_added(VirtViewerSession *session G_GNUC_UNUSED,
         if (priv->kiosk) {
             /* don't show extra monitors that don't fit on client */
             DEBUG_LOG("kiosk mode: skip extra monitors that don't fit on client");
-            g_object_unref(display);
             return;
         }
 
diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
index 20d5fb1..9072692 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -439,7 +439,7 @@ void virt_viewer_session_add_display(VirtViewerSession *session,
         return;
 
     session->priv->displays = g_list_append(session->priv->displays, display);
-    g_object_ref(display);
+    g_object_ref_sink(display);
     g_signal_emit_by_name(session, "session-display-added", display);
 
     virt_viewer_signal_connect_object(display, "monitor-geometry-changed",
-- 
1.9.3




More information about the virt-tools-list mailing list