summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-09-24 17:51:55 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-09-24 17:51:55 +0000
commitc5df47d03e1d4ba01ecbbd97cf8ae9c82d552fd3 (patch)
treed1ed75ab43d19cedbc47582d5b7b2190e8e38fd2 /src/ui/dialog
parentRemove remaining uses of sp_round. (diff)
downloadinkscape-c5df47d03e1d4ba01ecbbd97cf8ae9c82d552fd3.tar.gz
inkscape-c5df47d03e1d4ba01ecbbd97cf8ae9c82d552fd3.zip
Fix a crash in CUSTOM_TYPE Windows native file open dialogs
See also 49ea08c12ce0f931ba7fc79d8ad9f2fa42a7dca7 Fixes https://gitlab.com/inkscape/inkscape/issues/378
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index bd66b2d40..8c37176ea 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -187,27 +187,28 @@ void FileOpenDialogImplWin32::addFilterMenu(Glib::ustring name, Glib::ustring pa
{
std::list<Filter> filter_list;
- 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;
+ int extension_index = 0;
_extension_map = new Inkscape::Extension::Extension*[filter_count];
// 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 *
+
_filter = new wchar_t[filter_length];
wchar_t *filterptr = _filter;
@@ -290,8 +291,7 @@ void FileOpenDialogImplWin32::createFilterMenu()
filter.mod = imod;
filter_list.push_back(filter);
- filter_length += filter.name_length +
- filter.filter_length + 3; // Add 3 for two \0s and a *
+ filter_length += filter.name_length + filter.filter_length + 3; // Add 3 for two \0s and a *
// Add to the "All Inkscape Files" Entry
if(all_inkscape_files_filter.length() > 0)