You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
185 lines
8.7 KiB
185 lines
8.7 KiB
7 years ago
|
From 847139d26929fb8e97c58a7a34a21b95f0855b94 Mon Sep 17 00:00:00 2001
|
||
|
From: Ray Strode <rstrode@redhat.com>
|
||
|
Date: Fri, 16 Feb 2018 10:51:37 -0500
|
||
|
Subject: [PATCH] object: only print stacktraces when debugging enabled
|
||
|
|
||
|
We have a bunch of corruption right now spamming the
|
||
|
log.
|
||
|
|
||
|
This commit gets rid of the spam unless G_MESSAGES_DEBUG
|
||
|
is set.
|
||
|
---
|
||
|
gi/object.cpp | 105 ++++++++++++++++++++++++++++++++++------------------------
|
||
|
1 file changed, 61 insertions(+), 44 deletions(-)
|
||
|
|
||
|
diff --git a/gi/object.cpp b/gi/object.cpp
|
||
|
index e77de884..c2eb7dae 100644
|
||
|
--- a/gi/object.cpp 2018-01-27 17:38:36.000000000 -0500
|
||
|
+++ b/gi/object.cpp 2018-02-16 13:14:15.834892741 -0500
|
||
|
@@ -89,6 +89,29 @@ GJS_DEFINE_PRIV_FROM_JS(ObjectInstance,
|
||
|
|
||
|
static void disassociate_js_gobject (GObject *gobj);
|
||
|
|
||
|
+static void
|
||
|
+gjs_log_stacktrace(const char *format,
|
||
|
+ ...)
|
||
|
+{
|
||
|
+ const char *domain;
|
||
|
+ va_list args;
|
||
|
+
|
||
|
+ domain = g_getenv("G_MESSAGES_DEBUG");
|
||
|
+
|
||
|
+ if (!domain)
|
||
|
+ return;
|
||
|
+
|
||
|
+ if (!g_str_equal(domain, "all") &&
|
||
|
+ !strstr(domain, G_LOG_DOMAIN))
|
||
|
+ return;
|
||
|
+
|
||
|
+ va_start(args, format);
|
||
|
+ g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
|
||
|
+ va_end(args);
|
||
|
+
|
||
|
+ gjs_dumpstack();
|
||
|
+}
|
||
|
+
|
||
|
typedef enum {
|
||
|
SOME_ERROR_OCCURRED = false,
|
||
|
NO_SUCH_G_PROPERTY,
|
||
|
@@ -410,12 +433,11 @@ object_instance_get_prop(JSContext
|
||
|
return true;
|
||
|
|
||
|
if (priv->g_object_finalized) {
|
||
|
- g_critical("Object %s.%s (%p), has been already finalized. "
|
||
|
- "Impossible to get any property from it.",
|
||
|
- priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
- priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
- priv->gobj);
|
||
|
- gjs_dumpstack();
|
||
|
+ gjs_log_stacktrace("Object %s.%s (%p), has been already finalized. "
|
||
|
+ "Impossible to get any property from it.",
|
||
|
+ priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
+ priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
+ priv->gobj);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@@ -530,12 +552,11 @@ object_instance_set_prop(JSContext
|
||
|
return result.succeed();
|
||
|
|
||
|
if (priv->g_object_finalized) {
|
||
|
- g_critical("Object %s.%s (%p), has been already finalized. "
|
||
|
- "Impossible to set any property to it.",
|
||
|
- priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
- priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
- priv->gobj);
|
||
|
- gjs_dumpstack();
|
||
|
+ gjs_log_stacktrace("Object %s.%s (%p), has been already finalized. "
|
||
|
+ "Impossible to set any property to it.",
|
||
|
+ priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
+ priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
+ priv->gobj);
|
||
|
return result.succeed();
|
||
|
}
|
||
|
|
||
|
@@ -777,12 +798,11 @@ object_instance_resolve(JSContext
|
||
|
}
|
||
|
|
||
|
if (priv->g_object_finalized) {
|
||
|
- g_critical("Object %s.%s (%p), has been already finalized. "
|
||
|
- "Impossible to resolve it.",
|
||
|
- priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
- priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
- priv->gobj);
|
||
|
- gjs_dumpstack();
|
||
|
+ gjs_log_stacktrace("Object %s.%s (%p), has been already finalized. "
|
||
|
+ "Impossible to resolve it.",
|
||
|
+ priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
+ priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
+ priv->gobj);
|
||
|
|
||
|
*resolved = false;
|
||
|
return true;
|
||
|
@@ -1471,11 +1491,11 @@ object_instance_trace(JSTracer *tracer,
|
||
|
return;
|
||
|
|
||
|
if (priv->g_object_finalized) {
|
||
|
- g_debug("Object %s.%s (%p), has been already finalized. "
|
||
|
- "Impossible to trace it.",
|
||
|
- priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
- priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
- priv->gobj);
|
||
|
+ gjs_log_stacktrace("Object %s.%s (%p), has been already finalized. "
|
||
|
+ "Impossible to trace it.",
|
||
|
+ priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
+ priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
+ priv->gobj);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
@@ -1680,13 +1700,12 @@ real_connect_func(JSContext *context,
|
||
|
return false;
|
||
|
}
|
||
|
if (priv->g_object_finalized) {
|
||
|
- g_critical("Object %s.%s (%p), has been already deallocated - impossible to connect to signal. "
|
||
|
- "This might be caused by the fact that the object has been destroyed from C "
|
||
|
- "code using something such as destroy(), dispose(), or remove() vfuncs",
|
||
|
- priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
- priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
- priv->gobj);
|
||
|
- gjs_dumpstack();
|
||
|
+ gjs_log_stacktrace("Object %s.%s (%p), has been already deallocated - impossible to connect to signal. "
|
||
|
+ "This might be caused by the fact that the object has been destroyed from C "
|
||
|
+ "code using something such as destroy(), dispose(), or remove() vfuncs",
|
||
|
+ priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
+ priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
+ priv->gobj);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@@ -1777,13 +1796,12 @@ emit_func(JSContext *context,
|
||
|
}
|
||
|
|
||
|
if (priv->g_object_finalized) {
|
||
|
- g_critical("Object %s.%s (%p), has been already deallocated - impossible to emit signal. "
|
||
|
- "This might be caused by the fact that the object has been destroyed from C "
|
||
|
- "code using something such as destroy(), dispose(), or remove() vfuncs",
|
||
|
- priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
- priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
- priv->gobj);
|
||
|
- gjs_dumpstack();
|
||
|
+ gjs_log_stacktrace("Object %s.%s (%p), has been already deallocated - impossible to emit signal. "
|
||
|
+ "This might be caused by the fact that the object has been destroyed from C "
|
||
|
+ "code using something such as destroy(), dispose(), or remove() vfuncs",
|
||
|
+ priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
+ priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
+ priv->gobj);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@@ -2197,13 +2215,12 @@ gjs_typecheck_object(JSContext *co
|
||
|
}
|
||
|
|
||
|
if (priv->g_object_finalized) {
|
||
|
- g_critical("Object %s.%s (%p), has been already deallocated - impossible to access to it. "
|
||
|
- "This might be caused by the fact that the object has been destroyed from C "
|
||
|
- "code using something such as destroy(), dispose(), or remove() vfuncs",
|
||
|
- priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
- priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
- priv->gobj);
|
||
|
- gjs_dumpstack();
|
||
|
+ gjs_log_stacktrace("Object %s.%s (%p), has been already deallocated - impossible to access to it. "
|
||
|
+ "This might be caused by the fact that the object has been destroyed from C "
|
||
|
+ "code using something such as destroy(), dispose(), or remove() vfuncs",
|
||
|
+ priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
|
||
|
+ priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
|
||
|
+ priv->gobj);
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
--
|
||
|
2.14.3
|
||
|
|