diff --git a/app/app.c b/app/app.c index 8d1a52d8cd..8da70a77fe 100644 --- a/app/app.c +++ b/app/app.c @@ -56,6 +56,7 @@ #include "core/gimp.h" #include "core/gimp-batch.h" #include "core/gimp-user-install.h" +#include "core/gimpbacktrace.h" #include "core/gimpimage.h" #include "file/file-open.h" @@ -217,6 +218,12 @@ app_run (const gchar *full_prog_name, filenames = NULL; } + /* Initialize GimpBacktrace early on. In particular, we want the + * Windows backend to catch the SET_THREAD_NAME exceptions of newly + * created threads. + */ + gimp_backtrace_init (); + /* Language needs to be determined first, before any GimpContext is * instantiated (which happens when the Gimp object is created) * because its properties need to be properly localized in the diff --git a/app/core/gimpbacktrace-linux.c b/app/core/gimpbacktrace-linux.c index ea73b2bde3..9e4f38d12b 100644 --- a/app/core/gimpbacktrace-linux.c +++ b/app/core/gimpbacktrace-linux.c @@ -24,6 +24,8 @@ #include "config.h" +#include + #include "gimpbacktrace-backend.h" @@ -46,8 +48,6 @@ #include #endif -#include - #include "core-types.h" #include "gimpbacktrace.h" @@ -237,8 +237,13 @@ gimp_backtrace_signal_handler (gint signum) /* public functions */ -gboolean +void gimp_backtrace_init (void) +{ +} + +gboolean +gimp_backtrace_start (void) { g_mutex_lock (&mutex); @@ -294,7 +299,7 @@ gimp_backtrace_init (void) } void -gimp_backtrace_shutdown (void) +gimp_backtrace_stop (void) { g_return_if_fail (n_initializations > 0); diff --git a/app/core/gimpbacktrace-none.c b/app/core/gimpbacktrace-none.c index c2c9d758ee..489a63c7fe 100644 --- a/app/core/gimpbacktrace-none.c +++ b/app/core/gimpbacktrace-none.c @@ -21,16 +21,14 @@ #include "config.h" +#include + #include "gimpbacktrace-backend.h" #ifdef GIMP_BACKTRACE_BACKEND_NONE -#include "config.h" - -#include - #include "core-types.h" #include "gimpbacktrace.h" @@ -39,14 +37,19 @@ /* public functions */ -gboolean +void gimp_backtrace_init (void) +{ +} + +gboolean +gimp_backtrace_start (void) { return FALSE; } void -gimp_backtrace_shutdown (void) +gimp_backtrace_stop (void) { } diff --git a/app/core/gimpbacktrace.h b/app/core/gimpbacktrace.h index 64c7bc3519..ea676a2db5 100644 --- a/app/core/gimpbacktrace.h +++ b/app/core/gimpbacktrace.h @@ -28,13 +28,16 @@ typedef struct _GimpBacktraceAddressInfo GimpBacktraceAddressInfo; struct _GimpBacktraceAddressInfo { gchar object_name[256]; + gchar symbol_name[256]; guintptr symbol_address; }; -gboolean gimp_backtrace_init (void); -void gimp_backtrace_shutdown (void); +void gimp_backtrace_init (void); + +gboolean gimp_backtrace_start (void); +void gimp_backtrace_stop (void); GimpBacktrace * gimp_backtrace_new (gboolean include_current_thread); void gimp_backtrace_free (GimpBacktrace *backtrace); diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c index d100d797a8..7c3c90211c 100644 --- a/app/widgets/gimpdashboard.c +++ b/app/widgets/gimpdashboard.c @@ -4120,7 +4120,7 @@ gimp_dashboard_log_start_recording (GimpDashboard *dashboard, priv->log_include_backtrace = FALSE; if (priv->log_include_backtrace) - has_backtrace = gimp_backtrace_init (); + has_backtrace = gimp_backtrace_start (); else has_backtrace = FALSE; @@ -4188,7 +4188,7 @@ gimp_dashboard_log_start_recording (GimpDashboard *dashboard, if (priv->log_error) { - gimp_backtrace_shutdown (); + gimp_backtrace_stop (); g_clear_object (&priv->log_output); @@ -4238,9 +4238,6 @@ gimp_dashboard_log_stop_recording (GimpDashboard *dashboard, g_mutex_lock (&priv->mutex); - if (priv->log_include_backtrace) - gimp_backtrace_shutdown (); - gimp_dashboard_log_printf (dashboard, "\n" "\n"); @@ -4265,6 +4262,9 @@ gimp_dashboard_log_stop_recording (GimpDashboard *dashboard, "\n" "\n"); + if (priv->log_include_backtrace) + gimp_backtrace_stop (); + if (! priv->log_error) g_output_stream_close (priv->log_output, NULL, &priv->log_error);