summaryrefslogtreecommitdiff
path: root/agent/component.c
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2014-01-31 01:06:08 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.com>2014-01-31 01:52:16 -0500
commitfaa90ddafd4a43533be13b2b2ca646c9edfa12c2 (patch)
tree5d302ec4092048490ec1a5fb99c01fd031ee7793 /agent/component.c
parent011e3c2964d87eb9f7e9ef46cf99ea2b201037d1 (diff)
downloadlibnice-faa90ddafd4a43533be13b2b2ca646c9edfa12c2.tar.gz
agent: Remove weak pointers, they aren't thread safe anyway
And we get close to 10% perf boost
Diffstat (limited to 'agent/component.c')
-rw-r--r--agent/component.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/agent/component.c b/agent/component.c
index a2044f0..296f353 100644
--- a/agent/component.c
+++ b/agent/component.c
@@ -652,7 +652,8 @@ emit_io_callback_cb (gpointer user_data)
NiceAgent *agent;
agent = component->agent;
- g_object_add_weak_pointer (G_OBJECT (agent), (gpointer *) &agent);
+
+ g_object_ref (agent);
stream_id = component->stream->id;
component_id = component->id;
@@ -690,11 +691,10 @@ emit_io_callback_cb (gpointer user_data)
io_user_data);
/* Check for the user destroying things underneath our feet. */
- if (agent == NULL ||
- !agent_find_component (agent, stream_id, component_id,
+ if (!agent_find_component (agent, stream_id, component_id,
NULL, &component)) {
nice_debug ("%s: Agent or component destroyed.", G_STRFUNC);
- return G_SOURCE_REMOVE;
+ goto done;
}
g_queue_pop_head (&component->pending_io_messages);
@@ -706,7 +706,8 @@ emit_io_callback_cb (gpointer user_data)
component->io_callback_id = 0;
g_mutex_unlock (&component->io_mutex);
- g_object_remove_weak_pointer (G_OBJECT (agent), (gpointer *) &agent);
+ done:
+ g_object_unref (agent);
return G_SOURCE_REMOVE;
}