[grits] Tighten up locking to allow for nested objects



commit 81c9427fa6f17cf38babb6e1beda9873db758a58
Author: Andy Spencer <andy753421 gmail com>
Date:   Tue May 24 05:09:16 2011 +0000

    Tighten up locking to allow for nested objects

 src/grits-opengl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/grits-opengl.c b/src/grits-opengl.c
index a42cdab..d8eda27 100644
--- a/src/grits-opengl.c
+++ b/src/grits-opengl.c
@@ -414,16 +414,16 @@ static GritsObject *grits_opengl_remove(GritsViewer *_opengl, gpointer _link)
 {
 	g_assert(GRITS_IS_OPENGL(_opengl));
 	GritsOpenGL *opengl = GRITS_OPENGL(_opengl);
-	g_mutex_lock(opengl->objects_lock);
 	GList *link = _link;
+	g_mutex_lock(opengl->objects_lock);
 	GritsObject *object = link->data;
 	/* Just unlink and free it, link->prev is assured */
 	link->prev->next = link->next;
 	if (link->next)
 		link->next->prev = link->prev;
+	g_mutex_unlock(opengl->objects_lock);
 	g_free(link);
 	g_object_unref(object);
-	g_mutex_unlock(opengl->objects_lock);
 	return object;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]