summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-28 10:37:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-28 10:40:14 +0200
commit24d1898c41fd559279827b64cc16dabeb132b0e1 (patch)
tree1ed7f4c33b55371dd42aad3028431fd797956122
parent12d6ff4af6dc39a220d0452cebc62e4954ea11e6 (diff)
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.
-rw-r--r--gui/main.cpp12
1 files 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