Commit b9f1ab8f authored by Ell's avatar Ell

app: more cleanup in GimpBacktrace

Improve out-of-range check in gimp_backtrace_find_thread_by_id().

Remove unnecessary #include <exchndl.h> in gimpbacktrace-windows.c,
and revert commit 644234e9 (the
DrMingw detection happens at runtime).  The Windows backend can
work without DrMingw, it just can't find all the symbols, and
doesn't provide source-location information.
parent 644234e9
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#ifdef __gnu_linux__ #ifdef __gnu_linux__
# define GIMP_BACKTRACE_BACKEND_LINUX # define GIMP_BACKTRACE_BACKEND_LINUX
#elif defined (G_OS_WIN32) && defined (ARCH_X86) && defined (HAVE_EXCHNDL) #elif defined (G_OS_WIN32) && defined (ARCH_X86)
# define GIMP_BACKTRACE_BACKEND_WINDOWS # define GIMP_BACKTRACE_BACKEND_WINDOWS
#else #else
# define GIMP_BACKTRACE_BACKEND_NONE # define GIMP_BACKTRACE_BACKEND_NONE
......
...@@ -522,7 +522,8 @@ gimp_backtrace_find_thread_by_id (GimpBacktrace *backtrace, ...@@ -522,7 +522,8 @@ gimp_backtrace_find_thread_by_id (GimpBacktrace *backtrace,
g_return_val_if_fail (backtrace != NULL, -1); g_return_val_if_fail (backtrace != NULL, -1);
if (thread_hint < backtrace->n_threads && if (thread_hint >= 0 &&
thread_hint < backtrace->n_threads &&
backtrace->threads[thread_hint].tid == tid) backtrace->threads[thread_hint].tid == tid)
{ {
return thread_hint; return thread_hint;
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include <tlhelp32.h> #include <tlhelp32.h>
#include <dbghelp.h> #include <dbghelp.h>
#include <exchndl.h>
#include <string.h> #include <string.h>
#include "core-types.h" #include "core-types.h"
...@@ -578,7 +576,8 @@ gimp_backtrace_find_thread_by_id (GimpBacktrace *backtrace, ...@@ -578,7 +576,8 @@ gimp_backtrace_find_thread_by_id (GimpBacktrace *backtrace,
g_return_val_if_fail (backtrace != NULL, -1); g_return_val_if_fail (backtrace != NULL, -1);
if (thread_hint < backtrace->n_threads && if (thread_hint >= 0 &&
thread_hint < backtrace->n_threads &&
backtrace->threads[thread_hint].tid == tid) backtrace->threads[thread_hint].tid == tid)
{ {
return thread_hint; return thread_hint;
......
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