From 8657658c70c94460b97a4db76c909e8e9c66f3f3 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 7 Jan 2010 00:48:27 +0000 Subject: [PATCH] Fix undefined behavior sometimes resulting in a crash when copying styles to or from storage when the style name already exists. Patch by Paranoja. Closes #1096. Originally committed to SVN as r3961. --- aegisub/src/dialog_style_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aegisub/src/dialog_style_manager.cpp b/aegisub/src/dialog_style_manager.cpp index 33626d20e..0e597098e 100644 --- a/aegisub/src/dialog_style_manager.cpp +++ b/aegisub/src/dialog_style_manager.cpp @@ -601,7 +601,7 @@ void DialogStyleManager::OnCopyToStorage (wxCommandEvent &event) { for (std::list::iterator style = Store.style.begin(); style != Store.style.end(); ++style) { if ((*style)->name.CmpNoCase(styleName) == 0) { addStyle = false; - if (wxYES == wxMessageBox(wxString::Format(_T("There is already a style with the name \"%s\" on the current storage. Proceed and overwrite anyway?"),styleName), _T("Style name collision."), wxYES_NO)) { + if (wxYES == wxMessageBox(wxString::Format(_T("There is already a style with the name \"%s\" on the current storage. Proceed and overwrite anyway?"),styleName.c_str()), _T("Style name collision."), wxYES_NO)) { **style = *styleMap.at(selections[i]); } break; @@ -632,7 +632,7 @@ void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &event) { for (std::vector::iterator style = styleMap.begin(); style != styleMap.end(); ++style) { if ((*style)->name.CmpNoCase(styleName) == 0) { addStyle = false; - if (wxYES == wxMessageBox(wxString::Format(_T("There is already a style with the name \"%s\" on the current script. Proceed and overwrite anyway?"),styleName), _T("Style name collision."), wxYES_NO)) { + if (wxYES == wxMessageBox(wxString::Format(_T("There is already a style with the name \"%s\" on the current script. Proceed and overwrite anyway?"),styleName.c_str()), _T("Style name collision."), wxYES_NO)) { **style = *styleStorageMap.at(selections[i]); } break;