From 49ea08c12ce0f931ba7fc79d8ad9f2fa42a7dca7 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Wed, 21 Jun 2017 01:44:34 +0200 Subject: Fix a crash in CUSTOM_TYPE Windows native file save dialogs Fixed bugs: - https://bugs.launchpad.net/inkscape/+bug/1639701 --- src/ui/dialog/filedialogimpl-win32.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ui/dialog/filedialogimpl-win32.cpp') diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 1efec7d52..6c8ce2620 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1685,28 +1685,28 @@ void FileSaveDialogImplWin32::addFileType(Glib::ustring name, Glib::ustring patt knownExtensions.clear(); - int extension_index = 0; - int filter_length = 1; - - ustring all_exe_files_filter = pattern; Filter all_exe_files; const gchar *all_exe_files_filter_name = name.data(); + const gchar *all_exe_files_filter = pattern.data(); // Calculate the amount of memory required int filter_count = 1; - + int filter_length = 1; // Filter Executable Files all_exe_files.name = g_utf8_to_utf16(all_exe_files_filter_name, -1, NULL, &all_exe_files.name_length, NULL); - all_exe_files.filter = g_utf8_to_utf16(all_exe_files_filter.data(), + all_exe_files.filter = g_utf8_to_utf16(all_exe_files_filter, -1, NULL, &all_exe_files.filter_length, NULL); all_exe_files.mod = NULL; filter_list.push_front(all_exe_files); + + filter_length = all_exe_files.name_length + all_exe_files.filter_length + 3; // Add 3 for two \0s and a * knownExtensions.insert( Glib::ustring(all_exe_files_filter).casefold() ); + int extension_index = 0; _extension_map = new Inkscape::Extension::Extension*[filter_count]; _filter = new wchar_t[filter_length]; -- cgit v1.2.3