[gimp] app: more cleanup in GimpBacktrace



commit b9f1ab8f53c41773384130ec6b30ae97204197ad
Author: Ell <ell_se yahoo com>
Date:   Wed Sep 5 14:48:59 2018 -0400

    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 644234e99d18f9608e44c9a6338c73f3e4872168 (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.

 app/core/gimpbacktrace-backend.h | 2 +-
 app/core/gimpbacktrace-linux.c   | 3 ++-
 app/core/gimpbacktrace-windows.c | 5 ++---
 3 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimpbacktrace-backend.h b/app/core/gimpbacktrace-backend.h
index 837d26547a..4bfb1c9434 100644
--- a/app/core/gimpbacktrace-backend.h
+++ b/app/core/gimpbacktrace-backend.h
@@ -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
diff --git a/app/core/gimpbacktrace-linux.c b/app/core/gimpbacktrace-linux.c
index 43859df1ab..699e760858 100644
--- a/app/core/gimpbacktrace-linux.c
+++ b/app/core/gimpbacktrace-linux.c
@@ -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;
diff --git a/app/core/gimpbacktrace-windows.c b/app/core/gimpbacktrace-windows.c
index 8fe705e818..d606e49ffe 100644
--- a/app/core/gimpbacktrace-windows.c
+++ b/app/core/gimpbacktrace-windows.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]