diff options
-rw-r--r-- | dbus/object_proxy.cc | 3 | ||||
-rw-r--r-- | dbus/util.h | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc index 7347db0..974b24c 100644 --- a/dbus/object_proxy.cc +++ b/dbus/object_proxy.cc @@ -275,7 +275,7 @@ void ObjectProxy::StartAsyncMethodCall(int timeout_ms, pending_call, &ObjectProxy::OnPendingCallIsCompleteThunk, data, - NULL); + &DeleteVoidPointer<OnPendingCallIsCompleteData>); CHECK(success) << "Unable to allocate memory"; dbus_pending_call_unref(pending_call); @@ -367,7 +367,6 @@ void ObjectProxy::OnPendingCallIsCompleteThunk(DBusPendingCall* pending_call, data->response_callback, data->error_callback, data->start_time); - delete data; } bool ObjectProxy::ConnectToNameOwnerChangedSignal() { diff --git a/dbus/util.h b/dbus/util.h index b983b6f..b05834d 100644 --- a/dbus/util.h +++ b/dbus/util.h @@ -23,6 +23,13 @@ CHROME_DBUS_EXPORT std::string GetAbsoluteMemberName( const std::string& interface_name, const std::string& member_name); +// Similar to base::DeletePointer, but takes void* as an argument. +// Used as DBusFreeFunction. +template<typename T> +void DeleteVoidPointer(void* memory) { + delete static_cast<T*>(memory); +} + } // namespace dbus #endif // DBUS_UTIL_H_ |