From fbafe7441441d5685b6a464357f6e8516792b6ff Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 17 Apr 2020 23:18:06 +0200 Subject: [PATCH] Pass proper argument to wxFileDialog File name only should be passed for `defaultFile' parameter otherwise assertion in wxFileName::Assign() fails ("the file name shouldn't contain the path"). --- src/propgrid/props.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index 21dfeab21d..4cf11f7aed 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -2191,9 +2191,9 @@ bool wxFileProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) { wxASSERT_MSG(value.IsType(wxS("string")), "Function called for incompatible property"); - wxString strVal = value.GetString(); - wxFileName filename = strVal; + wxFileName filename(value.GetString()); wxString path = filename.GetPath(); + wxString file = filename.GetFullName(); if ( path.empty() && !m_basePath.empty() ) path = m_basePath; @@ -2201,7 +2201,7 @@ bool wxFileProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxFileDialog dlg(pg->GetPanel(), m_dlgTitle.empty() ? _("Choose a file") : m_dlgTitle, m_initialPath.empty() ? path : m_initialPath, - strVal, + file, m_wildcard.empty() ? wxALL_FILES : m_wildcard, m_dlgStyle, wxDefaultPosition);