libnm-glib: fix crash by taking additional ref in nm-remote-connection/result_cb

result_cb invokes a function pointer provided by the user. Nothing prevents
the user from destroying the NMRemoteConnection in the callback, which leads
to a crash. Take an additional ref of NMRemoteConnection to keep it
alive.

This probably caused a crash for nm-applet:
https://bugzilla.redhat.com/show_bug.cgi?id=1030403

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2013-11-18 22:20:05 +01:00
parent f93c154161
commit fbcabeb7f7

View file

@ -137,12 +137,14 @@ result_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_data)
RemoteCall *call = user_data;
NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc) call->callback;
GError *error = NULL;
NMRemoteConnection *self = g_object_ref (call->self);
dbus_g_proxy_end_call (proxy, proxy_call, &error, G_TYPE_INVALID);
if (func)
(*func) (call->self, error, call->user_data);
g_clear_error (&error);
remote_call_complete (call->self, call);
g_object_unref (self);
}
/**