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

@ -54,6 +54,9 @@ gimp_init_signal_handlers (gchar **backtrace_file)
time_t t;
gchar *filename;
gchar *dir;
#if defined (G_OS_WIN32) && defined (HAVE_EXCHNDL)
wchar_t *backtrace_file_utf16;
#endif
#ifdef G_OS_WIN32
/* 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);
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 */

View file

@ -959,7 +959,7 @@ AC_MSG_RESULT([$with_win32_32bit_dll_folder])
enable_drmingw="no"
if test "x$platform_win32" = "xyes"; then
# 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])
LIBS="-lexchndl $LIBS"
@ -968,7 +968,7 @@ if test "x$platform_win32" = "xyes"; then
[enable_drmingw="no (ExcHndl library missing)"]
)
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

View file

@ -227,6 +227,7 @@ gimp_main (GType plug_in_type,
time_t t;
gchar *filename;
gchar *dir;
wchar_t *plug_in_backtrace_path_utf16;
/* This has to be the non-roaming directory (i.e., the local
* 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);
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 */

View file

@ -578,7 +578,7 @@ conf.set('HAVE_LIBUNWIND', libunwind.found())
drmingw = no_dep
if platform_windows
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
drmingw = declare_dependency(dependencies: exchndl)
endif