From 4e97221b9b9d3de042fc9ff6922b33908a3786cf Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Mar 2006 20:51:58 +0000 Subject: [PATCH] - fix a race the device objects refcount during creation of the worker thread. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1603 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- src/nm-device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nm-device.c b/src/nm-device.c index bdc36493c2..8b9ffd0864 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -212,9 +212,11 @@ nm_device_new (const char *iface, if (NM_DEVICE_GET_CLASS (dev)->init) NM_DEVICE_GET_CLASS (dev)->init (dev); + /* This ref should logically go in nm_device_worker, but we need the + ref to be taken before the worker thread is scheduled on a cpu. */ + g_object_ref (G_OBJECT (dev)); dev->priv->worker = g_thread_create (nm_device_worker, dev, TRUE, NULL); g_assert (dev->priv->worker); - g_object_ref (G_OBJECT (dev)); /* For the worker thread */ /* Block until our device thread has actually had a chance to start. */ args[0] = &dev->priv->worker_started;