[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / gio / gapplicationimpl-dbus.c
index dea8ac2..4b1b5c9 100644 (file)
@@ -46,7 +46,7 @@
 /* DBus Interface definition {{{1 */
 
 /* For documentation of these interfaces, see
- * https://live.gnome.org/GApplication/DBusAPI
+ * https://wiki.gnome.org/Projects/GLib/GApplication/DBusAPI
  */
 static const gchar org_gtk_Application_xml[] =
   "<node>"
@@ -753,6 +753,7 @@ g_application_impl_command_line (GApplicationImpl    *impl,
                                               g_variant_new ("(o^aay@a{sv})", object_path, arguments, platform_data),
                                               G_VARIANT_TYPE ("(i)"), 0, G_MAXINT, fd_list, NULL,
                                               g_application_impl_cmdline_done, &data);
+    g_object_unref (fd_list);
   }
 #else
   g_dbus_connection_call (impl->session_bus, impl->bus_name, impl->object_path,
@@ -851,13 +852,13 @@ g_dbus_command_line_get_stdin (GApplicationCommandLine *cmdline)
 
   if (fd_list && g_unix_fd_list_get_length (fd_list))
     {
-      gint *fds, n_fds, i;
+      gint *fds, i;
 
-      fds = g_unix_fd_list_steal_fds (fd_list, &n_fds);
-      result = g_unix_input_stream_new (fds[0], TRUE);
-      for (i = 1; i < n_fds; i++)
-        (void) g_close (fds[i], NULL);
-      g_free (fds);
+      fds = g_unix_fd_list_peek_fds (fd_list, NULL);
+      result = g_unix_input_stream_new (fds[0], FALSE);
+      g_object_weak_ref (G_OBJECT (result),
+                         (GWeakNotify) g_object_unref,
+                         g_object_ref (fd_list));
     }
 
   return result;