[gimp] app: in GimpBacktrace Linux backend, don't leak backtrace when dropping threads
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: in GimpBacktrace Linux backend, don't leak backtrace when dropping threads
- Date: Sat, 1 Dec 2018 09:34:12 +0000 (UTC)
commit 01f940990260146a860f6956ebd962b45b0fc961
Author: Ell <ell_se yahoo com>
Date: Sat Dec 1 04:29:49 2018 -0500
app: in GimpBacktrace Linux backend, don't leak backtrace when dropping threads
Should have been part of commit
a29d040db52706d4e26f3b7955d5e1677528702e.
app/core/gimpbacktrace-linux.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimpbacktrace-linux.c b/app/core/gimpbacktrace-linux.c
index 72a50db29d..a8593f8a10 100644
--- a/app/core/gimpbacktrace-linux.c
+++ b/app/core/gimpbacktrace-linux.c
@@ -83,7 +83,6 @@ struct _GimpBacktrace
{
GimpBacktraceThread *threads;
gint n_threads;
- gint n_remaining_threads;
};
@@ -113,6 +112,7 @@ static struct sigaction orig_action;
static pid_t blacklisted_threads[MAX_N_THREADS];
static gint n_blacklisted_threads;
static GimpBacktrace *handler_backtrace;
+static gint handler_n_remaining_threads;
static gint handler_lock;
#ifdef HAVE_LIBBACKTRACE
@@ -282,7 +282,7 @@ gimp_backtrace_signal_handler (gint signum)
thread->n_frames = backtrace ((gpointer *) thread->frames,
MAX_N_FRAMES);
- g_atomic_int_dec_and_test (&curr_backtrace->n_remaining_threads);
+ g_atomic_int_dec_and_test (&handler_n_remaining_threads);
break;
}
@@ -412,13 +412,13 @@ gimp_backtrace_new (gboolean include_current_thread)
backtrace = g_slice_new (GimpBacktrace);
- backtrace->threads = g_new (GimpBacktraceThread, n_threads);
- backtrace->n_threads = n_threads;
- backtrace->n_remaining_threads = n_threads;
+ backtrace->threads = g_new (GimpBacktraceThread, n_threads);
+ backtrace->n_threads = n_threads;
while (! g_atomic_int_compare_and_exchange (&handler_lock, 0, -1));
- g_atomic_pointer_set (&handler_backtrace, backtrace);
+ g_atomic_pointer_set (&handler_backtrace, backtrace);
+ g_atomic_int_set (&handler_n_remaining_threads, n_threads);
g_atomic_int_set (&handler_lock, 0);
@@ -441,7 +441,7 @@ gimp_backtrace_new (gboolean include_current_thread)
start_time = g_get_monotonic_time ();
- while (g_atomic_int_get (&backtrace->n_remaining_threads) > 0)
+ while (g_atomic_int_get (&handler_n_remaining_threads) > 0)
{
gint64 time = g_get_monotonic_time ();
@@ -458,7 +458,7 @@ gimp_backtrace_new (gboolean include_current_thread)
g_atomic_int_set (&handler_lock, 0);
#if 0
- if (backtrace->n_remaining_threads > 0)
+ if (handler_n_remaining_threads > 0)
{
gint j = 0;
@@ -500,7 +500,7 @@ gimp_backtrace_new (gboolean include_current_thread)
void
gimp_backtrace_free (GimpBacktrace *backtrace)
{
- if (! backtrace || backtrace->n_remaining_threads > 0)
+ if (! backtrace)
return;
g_free (backtrace->threads);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]