From 24d1898c41fd559279827b64cc16dabeb132b0e1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 28 Aug 2016 10:37:30 +0200 Subject: gui/main: fix MSVC crash on exit Qt loads plugins from its install prefix and after main() exits it unloads qgif which has a crash. So disable the Qt install prefix plugins and only use our own directory's contents. --- gui/main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/main.cpp b/gui/main.cpp index e34b4715..0d1ec06b 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -96,14 +96,18 @@ void add_win32_path() // workaround QTBUG-38598, allow for launching from another directory static void add_program_library_path() { - char* p = _pgmptr; - char path[MAX_PATH+1]; - strcpy(path, p); + // Windows 10 allows for paths longer than MAX_PATH via fsutil and friends, shit + const char* p = _pgmptr; + char path[4096+1]; + + strncpy(path, p, sizeof(path)-1); + path[sizeof(path)-1] = '\0'; + char* ptr = strrchr(path, '\\'); if (ptr) { *ptr = '\0'; - QCoreApplication::addLibraryPath(path); + QCoreApplication::setLibraryPaths({ path }); } } #endif -- cgit v1.2.3