[Pkg-telepathy-commits] [libnice] 89/265: agent: Hold a reference to pseudotcp while calling its callbacks
Simon McVittie
smcv at debian.org
Wed May 14 12:04:56 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository libnice.
commit dbec8156337cd1fb68f424f521b317e7fbcbe562
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date: Fri Jan 3 15:03:08 2014 +0000
agent: Hold a reference to pseudotcp while calling its callbacks
This prevents the pseudotcp socket from being destroyed from within a
callback.
---
agent/pseudotcp.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/agent/pseudotcp.c b/agent/pseudotcp.c
index 1c9a1b9..dda3157 100644
--- a/agent/pseudotcp.c
+++ b/agent/pseudotcp.c
@@ -874,11 +874,20 @@ gboolean
pseudo_tcp_socket_notify_packet(PseudoTcpSocket *self,
const gchar * buffer, guint32 len)
{
+ gboolean retval;
+
if (len > MAX_PACKET) {
//LOG_F(WARNING) << "packet too large";
return FALSE;
}
- return parse(self, (guint8 *) buffer, len);
+
+ /* Hold a reference to the PseudoTcpSocket during parsing, since it may be
+ * closed from within a callback. */
+ g_object_ref (self);
+ retval = parse (self, (guint8 *) buffer, len);
+ g_object_unref (self);
+
+ return retval;
}
gboolean
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git
More information about the Pkg-telepathy-commits
mailing list