- 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:
@@ -212,9 +212,11 @@ nm_device_new (const char *iface,
|
|||||||
if (NM_DEVICE_GET_CLASS (dev)->init)
|
if (NM_DEVICE_GET_CLASS (dev)->init)
|
||||||
NM_DEVICE_GET_CLASS (dev)->init (dev);
|
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);
|
dev->priv->worker = g_thread_create (nm_device_worker, dev, TRUE, NULL);
|
||||||
g_assert (dev->priv->worker);
|
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. */
|
/* Block until our device thread has actually had a chance to start. */
|
||||||
args[0] = &dev->priv->worker_started;
|
args[0] = &dev->priv->worker_started;
|
||||||
|
Reference in New Issue
Block a user