[gjs] function: Better message about call during GC
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] function: Better message about call during GC
- Date: Tue, 18 Jul 2017 15:36:10 +0000 (UTC)
commit 62a2b790920720b4eba1bc156964b1704f930841
Author: Philip Chimento <philip endlessm com>
Date: Thu Jul 13 18:12:23 2017 -0700
function: Better message about call during GC
GJS can attempt to call back into JS during garbage collection if you
implement vfunc_remove() on your container class. (Destroying a container
will remove all its child widgets, and if you have implemented
vfunc_remove() in JS then that will cause a JS call.)
Note this possibility in the warning message, and also add whatever
information we can get about the offending callback without calling into
JSAPI.
https://bugzilla.gnome.org/show_bug.cgi?id=785040
gi/function.cpp | 10 ++++++++--
gi/value.cpp | 5 +++--
2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index 32d518a..6ac04a9 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -189,8 +189,14 @@ gjs_callback_closure(ffi_cif *cif,
g_critical("Attempting to call back into JSAPI during the sweeping phase of GC. "
"This is most likely caused by not destroying a Clutter actor or Gtk+ "
"widget with ::destroy signals connected, but can also be caused by "
- "using the destroy() or dispose() vfuncs. Because it would crash the "
- "application, it has been blocked and the JS callback not invoked.");
+ "using the destroy(), dispose(), or remove() vfuncs. "
+ "Because it would crash the application, it has been "
+ "blocked and the JS callback not invoked.");
+ if (trampoline->info) {
+ const char *name = g_base_info_get_name(static_cast<GIBaseInfo *>(trampoline->info));
+ g_critical("The offending callback was %s()%s.", name,
+ trampoline->is_vfunc ? ", a vfunc" : "");
+ }
/* A gjs_dumpstack() would be nice here, but we can't,
because that works by creating a new Error object and
reading the stack property, which is the worst possible
diff --git a/gi/value.cpp b/gi/value.cpp
index 2e6032d..6585375 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -143,8 +143,9 @@ closure_marshal(GClosure *closure,
g_critical("Attempting to call back into JSAPI during the sweeping phase of GC. "
"This is most likely caused by not destroying a Clutter actor or Gtk+ "
"widget with ::destroy signals connected, but can also be caused by "
- "using the destroy() or dispose() vfuncs. Because it would crash the "
- "application, it has been blocked and the JS callback not invoked.");
+ "using the destroy(), dispose(), or remove() vfuncs. "
+ "Because it would crash the application, it has been "
+ "blocked and the JS callback not invoked.");
if (hint) {
gpointer instance;
g_signal_query(hint->signal_id, &signal_query);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]