[gjs] object: Downgrade severity of toggle pending on dissociate
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] object: Downgrade severity of toggle pending on dissociate
- Date: Tue, 28 Feb 2017 00:05:57 +0000 (UTC)
commit e29048195da2e4ee12e6094aa94312b62b4aebaf
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Feb 26 16:11:50 2017 -0800
object: Downgrade severity of toggle pending on dissociate
Since there may be idle toggle refs pending when a GObject is dissociated
from its JS wrapper, during the normal course of GJS usage, we should not
assert in this case. Instead log a critical warning with a diagnostic
message explaining when this is / isn't a bug.
https://bugzilla.gnome.org/show_bug.cgi?id=778862
gi/object.cpp | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index a6866b2..bd7db75 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1385,11 +1385,20 @@ disassociate_js_gobject(GObject *gobj)
g_object_weak_unref(priv->gobj, wrapped_gobj_dispose_notify, priv);
- /* Idles are already checked in the only caller of this
- function, the toggle ref notify, but let's check again...
- */
- g_assert(!cancel_toggle_idle(gobj, TOGGLE_UP));
- g_assert(!cancel_toggle_idle(gobj, TOGGLE_DOWN));
+ /* FIXME: this check fails when JS code runs after the main loop ends,
+ * because the idle functions are not dispatched without a main loop.
+ * The only situation I'm aware of where this happens is during the
+ * dbus_unregister stage in GApplication. Ideally this check should be an
+ * assertion.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=778862
+ */
+ if (cancel_toggle_idle(gobj, TOGGLE_UP) ||
+ cancel_toggle_idle(gobj, TOGGLE_DOWN))
+ g_critical("JS object wrapper for GObject %p (%s) is being released "
+ "while toggle references are still pending. This may happen "
+ "on exit in Gio.Application.vfunc_dbus_unregister(). If you "
+ "encounter it another situation, please report a GJS bug.",
+ gobj, G_OBJECT_TYPE_NAME(gobj));
invalidate_all_signals(priv);
release_native_object(priv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]