Use ExcHndlSetLogFileNameW ()

This is a Dr.MinGW function
This commit is contained in:
Luca Bacci 2023-01-02 18:16:45 +01:00 committed by Jehan
parent 11801cf402
commit cfaaec6347
4 changed files with 27 additions and 11 deletions

View file

@ -51,9 +51,12 @@ static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
void void
gimp_init_signal_handlers (gchar **backtrace_file) gimp_init_signal_handlers (gchar **backtrace_file)
{ {
time_t t; time_t t;
gchar *filename; gchar *filename;
gchar *dir; gchar *dir;
#if defined (G_OS_WIN32) && defined (HAVE_EXCHNDL)
wchar_t *backtrace_file_utf16;
#endif
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* This has to be the non-roaming directory (i.e., the local /* This has to be the non-roaming directory (i.e., the local
@ -92,7 +95,12 @@ gimp_init_signal_handlers (gchar **backtrace_file)
g_prevExceptionFilter = SetUnhandledExceptionFilter (gimp_sigfatal_handler); g_prevExceptionFilter = SetUnhandledExceptionFilter (gimp_sigfatal_handler);
ExcHndlInit (); ExcHndlInit ();
ExcHndlSetLogFileNameA (*backtrace_file);
if ((backtrace_file_utf16 = g_utf8_to_utf16 (*backtrace_file, -1, NULL, NULL, NULL)))
{
ExcHndlSetLogFileNameW (backtrace_file_utf16);
g_free (backtrace_file_utf16);
}
#endif /* HAVE_EXCHNDL */ #endif /* HAVE_EXCHNDL */

View file

@ -959,7 +959,7 @@ AC_MSG_RESULT([$with_win32_32bit_dll_folder])
enable_drmingw="no" enable_drmingw="no"
if test "x$platform_win32" = "xyes"; then if test "x$platform_win32" = "xyes"; then
# Check for Dr. Mingw # Check for Dr. Mingw
AC_CHECK_LIB(exchndl, ExcHndlSetLogFileNameA, AC_CHECK_LIB(exchndl, ExcHndlSetLogFileNameW,
[ [
AC_DEFINE(HAVE_EXCHNDL, 1, [Define to 1 when Dr. MingW is available]) AC_DEFINE(HAVE_EXCHNDL, 1, [Define to 1 when Dr. MingW is available])
LIBS="-lexchndl $LIBS" LIBS="-lexchndl $LIBS"
@ -968,7 +968,7 @@ if test "x$platform_win32" = "xyes"; then
[enable_drmingw="no (ExcHndl library missing)"] [enable_drmingw="no (ExcHndl library missing)"]
) )
fi fi
AM_CONDITIONAL(HAVE_EXCHNDL, test "x$ac_cv_lib_exchndl_ExcHndlSetLogFileNameA" = "xyes") AM_CONDITIONAL(HAVE_EXCHNDL, test "x$ac_cv_lib_exchndl_ExcHndlSetLogFileNameW" = "xyes")
########################### ###########################
# Check for backtrace() API # Check for backtrace() API

View file

@ -224,9 +224,10 @@ gimp_main (GType plug_in_type,
#ifdef HAVE_EXCHNDL #ifdef HAVE_EXCHNDL
/* Use Dr. Mingw (dumps backtrace on crash) if it is available. */ /* Use Dr. Mingw (dumps backtrace on crash) if it is available. */
{ {
time_t t; time_t t;
gchar *filename; gchar *filename;
gchar *dir; gchar *dir;
wchar_t *plug_in_backtrace_path_utf16;
/* This has to be the non-roaming directory (i.e., the local /* This has to be the non-roaming directory (i.e., the local
* directory) as backtraces correspond to the binaries on this * directory) as backtraces correspond to the binaries on this
@ -252,7 +253,14 @@ gimp_main (GType plug_in_type,
_prevExceptionFilter = SetUnhandledExceptionFilter (gimp_plugin_sigfatal_handler); _prevExceptionFilter = SetUnhandledExceptionFilter (gimp_plugin_sigfatal_handler);
ExcHndlInit (); ExcHndlInit ();
ExcHndlSetLogFileNameA (plug_in_backtrace_path);
plug_in_backtrace_path_utf16 = g_utf8_to_utf16 (plug_in_backtrace_path,
-1, NULL, NULL, NULL);
if (plug_in_backtrace_path_utf16)
{
ExcHndlSetLogFileNameW (plug_in_backtrace_path_utf16);
g_free (plug_in_backtrace_path_utf16);
}
} }
#endif /* HAVE_EXCHNDL */ #endif /* HAVE_EXCHNDL */

View file

@ -578,7 +578,7 @@ conf.set('HAVE_LIBUNWIND', libunwind.found())
drmingw = no_dep drmingw = no_dep
if platform_windows if platform_windows
exchndl = cc.find_library('exchndl', required: false) exchndl = cc.find_library('exchndl', required: false)
exchndl_fn = cc.has_function('ExcHndlSetLogFileNameA', dependencies: exchndl) exchndl_fn = cc.has_function('ExcHndlSetLogFileNameW', dependencies: exchndl)
if exchndl.found() and exchndl_fn if exchndl.found() and exchndl_fn
drmingw = declare_dependency(dependencies: exchndl) drmingw = declare_dependency(dependencies: exchndl)
endif endif