Commit 468a4ad1 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.

(cherry picked from commit b9f1ab8f)
parent e7dde73f
......@@ -24,7 +24,7 @@
#ifdef __gnu_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
#else
# define GIMP_BACKTRACE_BACKEND_NONE
......
......@@ -522,7 +522,8 @@ gimp_backtrace_find_thread_by_id (GimpBacktrace *backtrace,
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)
{
return thread_hint;
......
......@@ -34,8 +34,6 @@
#include <tlhelp32.h>
#include <dbghelp.h>
#include <exchndl.h>
#include <string.h>
#include "core-types.h"
......@@ -578,7 +576,8 @@ gimp_backtrace_find_thread_by_id (GimpBacktrace *backtrace,
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)
{
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