From 44219594d18e8c66624be8021fb436b130b14b26 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sun, 6 Nov 2022 08:11:05 +0100 Subject: Check return value from call to gtk_init_check() --- src/drivers/Posix/Fl_Posix_System_Driver.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/drivers/Posix') diff --git a/src/drivers/Posix/Fl_Posix_System_Driver.cxx b/src/drivers/Posix/Fl_Posix_System_Driver.cxx index 63d5d6101..dcf9e8f1a 100644 --- a/src/drivers/Posix/Fl_Posix_System_Driver.cxx +++ b/src/drivers/Posix/Fl_Posix_System_Driver.cxx @@ -247,7 +247,7 @@ void *Fl_Posix_System_Driver::dlopen_or_dlsym(const char *lib_name, const char * void *Fl_Posix_System_Driver::ptr_gtk = NULL; bool Fl_Posix_System_Driver::probe_for_GTK(int major, int minor, void **p_ptr_gtk) { - typedef void (*init_t)(int*, void*); + typedef int (*init_t)(int*, char***); init_t init_f = NULL; // was GTK previously loaded? if (Fl_Posix_System_Driver::ptr_gtk) { // yes, it was. @@ -287,7 +287,10 @@ bool Fl_Posix_System_Driver::probe_for_GTK(int major, int minor, void **p_ptr_gt char *p = setlocale(LC_ALL, NULL); if (p) before = fl_strdup(p); int ac = 0; - init_f(&ac, NULL); // may change the locale + if ( !init_f(&ac, NULL) ) { // may change the locale + free(before); + return false; + } if (before) { setlocale(LC_ALL, before); // restore calling program's current locale free(before); -- cgit v1.2.3