summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2014-02-23 22:25:03 +0100
committerGiovanni Campagna <scampa.giovanni@gmail.com>2014-04-10 21:43:09 +0200
commit54ff90dd480701931a64f4b157d5b0cd47164e9c (patch)
tree1e4539cc094154b07992bf92c8d3f6c8bdd6b2a3
parent24f8a69fa06cd64d3aff5f69047b3cfef23e9084 (diff)
downloadgjs-54ff90dd480701931a64f4b157d5b0cd47164e9c.tar.gz
object: remove bogus comment and code about GC in a secondary thread
handle_toggle_up() is only ever called from the main thread, and that's where GC marking happens. The background GC thread only deals with sweeping, and not even of JS objects! https://bugzilla.gnome.org/show_bug.cgi?id=725024
-rw-r--r--gi/object.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/gi/object.cpp b/gi/object.cpp
index 5809e089..8a63809e 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -865,8 +865,7 @@ handle_toggle_down(GObject *gobj)
}
static void
-handle_toggle_up(GObject *gobj,
- gboolean gc_already_blocked)
+handle_toggle_up(GObject *gobj)
{
ObjectInstance *priv;
JSObject *obj;
@@ -874,22 +873,11 @@ handle_toggle_up(GObject *gobj,
/* We need to root the JSObject associated with the passed in GObject so it
* doesn't get garbage collected (and lose any associated javascript state
* such as custom properties).
- *
- * Note it's possible that the garbage collector is running in a secondary
- * thread right now. If it is, we need to wait for it to finish, then block
- * it from starting again while we root the object. After it's blocked we need
- * to check if the associated JSObject was reaped. If it was we need to
- * abort mission.
*/
- if (!gc_already_blocked)
- gjs_block_gc();
-
obj = peek_js_obj(gobj);
- if (!obj) {
- /* Object already GC'd */
- goto out;
- }
+ if (!obj) /* Object already GC'd */
+ return;
priv = (ObjectInstance *) JS_GetPrivate(obj);
@@ -911,10 +899,6 @@ handle_toggle_up(GObject *gobj,
obj,
priv);
}
-
-out:
- if (!gc_already_blocked)
- gjs_unblock_gc();
}
static gboolean
@@ -929,7 +913,7 @@ idle_handle_toggle(gpointer data)
switch (operation->direction) {
case TOGGLE_UP:
- handle_toggle_up(operation->gobj, FALSE);
+ handle_toggle_up(operation->gobj);
break;
case TOGGLE_DOWN:
handle_toggle_down(operation->gobj);
@@ -1065,7 +1049,7 @@ wrapped_gobj_toggle_notify(gpointer data,
G_OBJECT_TYPE_NAME(gobj));
}
- handle_toggle_up(gobj, gc_blocked);
+ handle_toggle_up(gobj);
} else {
queue_toggle_idle(gobj, TOGGLE_UP);
}