Commit 65614047 authored by Sven Neumann's avatar Sven Neumann Committed by Ross Burton

gupnp-service: don't hold a reference on ourselves

GUPnPService used to hold a reference on itself for the run-time of
the initial asynchronous introspection. Due to this reference the
object can't be disposed until this call has finished. Now if you
create a device with services and immidiately destroy it, the
service will still be alive holding a pointer to the XML device
description that is not any longer valid. This leads to a crash
when the asynchronous introspection finishes.

Fix this crash by not keeping a reference on ourselves. The pending
introspection is then cancelled from the dispose handler.
parent 375878b3
......@@ -1312,13 +1312,11 @@ got_introspection (GUPnPServiceInfo *info,
const GError *error,
gpointer user_data)
{
GUPnPService *service;
GUPnPService *service = GUPNP_SERVICE (info);
const GList *state_variables, *l;
GHashTableIter iter;
gpointer data;
service = GUPNP_SERVICE (user_data);
if (introspection) {
state_variables =
gupnp_service_introspection_list_state_variables
......@@ -1347,8 +1345,6 @@ got_introspection (GUPnPServiceInfo *info,
while (g_hash_table_iter_next (&iter, NULL, &data))
send_initial_state ((SubscriptionData *) data);
g_object_unref (service);
}
static char *
......@@ -1389,8 +1385,7 @@ gupnp_service_constructor (GType type,
/* Get introspection and save state variable names */
gupnp_service_info_get_introspection_async (info,
got_introspection,
object);
g_object_ref (object);
NULL);
/* Get server */
context = gupnp_service_info_get_context (info);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment