Handle modeless dialogs which never fully open
Fixes crash when opening the spell checker dialog after no spelling errors were found previously. Closes #1491. Originally committed to SVN as r6824.
This commit is contained in:
parent
904b5aafe4
commit
c7fb7eb295
2 changed files with 12 additions and 9 deletions
|
@ -69,10 +69,13 @@ public:
|
|||
it->second->SetFocus();
|
||||
}
|
||||
else {
|
||||
wxDialog *d = new DialogType(c);
|
||||
created_dialogs[&typeid(DialogType)] = d;
|
||||
d->Bind(wxEVT_CLOSE_WINDOW, &DialogManager::OnClose, this);
|
||||
d->Show();
|
||||
try {
|
||||
wxDialog *d = new DialogType(c);
|
||||
created_dialogs[&typeid(DialogType)] = d;
|
||||
d->Bind(wxEVT_CLOSE_WINDOW, &DialogManager::OnClose, this);
|
||||
d->Show();
|
||||
}
|
||||
catch (agi::UserCancelException const&) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include "subs_edit_ctrl.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <libaegisub/exception.h>
|
||||
|
||||
static void save_skip_comments(wxCommandEvent &evt) {
|
||||
OPT_SET("Tool/Spell Checker/Skip Comments")->SetBool(!!evt.GetInt());
|
||||
}
|
||||
|
@ -93,15 +95,13 @@ DialogSpellChecker::DialogSpellChecker(agi::Context *context)
|
|||
{
|
||||
if (!spellchecker.get()) {
|
||||
wxMessageBox("No spellchecker available.", "Error", wxOK | wxICON_ERROR | wxCENTER);
|
||||
Destroy();
|
||||
return;
|
||||
throw agi::UserCancelException("No spellchecker available");
|
||||
}
|
||||
|
||||
dictionary_lang_codes = spellchecker->GetLanguageList();
|
||||
if (dictionary_lang_codes.empty()) {
|
||||
wxMessageBox("No spellchecker dictionaries available.", "Error", wxOK | wxICON_ERROR | wxCENTER);
|
||||
Destroy();
|
||||
return;
|
||||
throw agi::UserCancelException("No spellchecker dictionaries available");
|
||||
}
|
||||
|
||||
wxArrayString language_names(dictionary_lang_codes);
|
||||
|
@ -238,7 +238,7 @@ bool DialogSpellChecker::FindNext() {
|
|||
}
|
||||
else {
|
||||
wxMessageBox(_("Aegisub has found no spelling mistakes in this script."), _("Spell checking complete."));
|
||||
Destroy();
|
||||
throw agi::UserCancelException("No spelling mistakes");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue