- 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
This commit is contained in:
Peter Jones
2006-03-14 20:51:58 +00:00
parent efb46cb8c4
commit 4e97221b9b

View File

@@ -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;