Bug 1266054: GTK+: Hold references to |DBusPendingCall| in |RefPtr|, r=karlt
authorThomas Zimmermann <tdz@users.sourceforge.net>
Mon, 09 May 2016 12:28:37 +0200
changeset 321113 37073e486aca054d969f7390985b14ef24cfedc7
parent 321112 825c91333305321aa7e316e54f6d49852f334607
child 321114 0a84159395221fe92580c66a89e207005bc61325
push id9671
push userraliiev@mozilla.com
push dateMon, 06 Jun 2016 20:27:52 +0000
treeherdermozilla-aurora@cea65ca3d0bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1266054
milestone49.0a1
Bug 1266054: GTK+: Hold references to |DBusPendingCall| in |RefPtr|, r=karlt MozReview-Commit-ID: F5jb9tR5FGa
widget/gtk/WakeLockListener.cpp
--- a/widget/gtk/WakeLockListener.cpp
+++ b/widget/gtk/WakeLockListener.cpp
@@ -8,16 +8,17 @@
 #ifdef MOZ_ENABLE_DBUS
 
 #include "WakeLockListener.h"
 
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
 #include "mozilla/ipc/DBusMessageRefPtr.h"
+#include "mozilla/ipc/DBusPendingCallRefPtr.h"
 
 #define FREEDESKTOP_SCREENSAVER_TARGET    "org.freedesktop.ScreenSaver"
 #define FREEDESKTOP_SCREENSAVER_OBJECT    "/ScreenSaver"
 #define FREEDESKTOP_SCREENSAVER_INTERFACE "org.freedesktop.ScreenSaver"
 
 #define SESSION_MANAGER_TARGET            "org.gnome.SessionManager"
 #define SESSION_MANAGER_OBJECT            "/org/gnome/SessionManager"
 #define SESSION_MANAGER_INTERFACE         "org.gnome.SessionManager"
@@ -76,25 +77,25 @@ private:
   bool mWaitingForReply;
 };
 
 
 bool
 WakeLockTopic::SendMessage(DBusMessage* aMessage)
 {
   // send message and get a handle for a reply
-  DBusPendingCall* reply;
-  dbus_connection_send_with_reply(mConnection, aMessage, &reply,
+  RefPtr<DBusPendingCall> reply;
+  dbus_connection_send_with_reply(mConnection, aMessage,
+                                  reply.StartAssignment(),
                                   DBUS_TIMEOUT);
   if (!reply) {
     return false;
   }
 
   dbus_pending_call_set_notify(reply, &ReceiveInhibitReply, this, NULL);
-  dbus_pending_call_unref(reply);
 
   return true;
 }
 
 bool
 WakeLockTopic::SendFreeDesktopInhibitMessage()
 {
   RefPtr<DBusMessage> message = already_AddRefed<DBusMessage>(