Commit 422f6a55 authored by Ell's avatar Ell

app: more GimpBacktrace tidying

... in preparation for the Windows backend.
parent 2d415f53
......@@ -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
......
......@@ -24,6 +24,8 @@
#include "config.h"
#include <gio/gio.h>
#include "gimpbacktrace-backend.h"
......@@ -46,8 +48,6 @@
#include <libunwind.h>
#endif
#include <gio/gio.h>
#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);
......
......@@ -21,16 +21,14 @@
#include "config.h"
#include <gio/gio.h>
#include "gimpbacktrace-backend.h"
#ifdef GIMP_BACKTRACE_BACKEND_NONE
#include "config.h"
#include <gio/gio.h>
#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)
{
}
......
......@@ -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);
......
......@@ -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"
"</samples>\n");
......@@ -4265,6 +4262,9 @@ gimp_dashboard_log_stop_recording (GimpDashboard *dashboard,
"\n"
"</gimp-performance-log>\n");
if (priv->log_include_backtrace)
gimp_backtrace_stop ();
if (! priv->log_error)
g_output_stream_close (priv->log_output, NULL, &priv->log_error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment