diff --git a/docs/changes.txt b/docs/changes.txt index 57a5769bcc..4d09c8f13b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -143,6 +143,7 @@ All (GUI): - Add wxToolbook::EnablePage() (Stefan Ziegler). - Adapt AUI colours to system colour changes (Daniel Kulp). - Fix removing and inserting pages in wxToolbook (Stefan Ziegler). +- Fix bug in template selection in docview framework (jwiesemann). wxGTK: diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 54c4f6a5f7..c41b1f60ee 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1805,7 +1805,18 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, // first choose the template using the extension, if this fails (i.e. // wxFileSelectorEx() didn't fill it), then use the path if ( FilterIndex != -1 ) + { theTemplate = templates[FilterIndex]; + if ( theTemplate ) + { + // But don't use this template if it doesn't match the path as + // can happen if the user specified the extension explicitly + // but didn't bother changing the filter. + if ( !theTemplate->FileMatchesTemplate(path) ) + theTemplate = NULL; + } + } + if ( !theTemplate ) theTemplate = FindTemplateForPath(path); if ( !theTemplate )