summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscx <scx.mail@gmail.com>2019-09-01 23:40:47 +0200
committerAndrej Shadura <andrewsh@debian.org>2022-07-20 16:13:45 +0200
commitce0f939e77638678c186c64dee98a117d7c79f96 (patch)
tree1a2f68a76418e424a1b3d61085573e0f333a6ac9
parent7628ff781583272010ab7ef43a4dbd75e021f8b6 (diff)
[PATCH] Fix crashing when picking language
Aegisub crashes immediately after selecting any language from the end of the list (above the 100th position). This is because it can support no more than 100 languages. This patch extends this limit up to 1000 languages (locales). Fixes Aegisub/Aegisub#131 Gbp-Pq: Name fix-crash-spell-language.patch
-rw-r--r--src/subs_edit_ctrl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/subs_edit_ctrl.cpp b/src/subs_edit_ctrl.cpp
index c42ae28..e4ed529 100644
--- a/src/subs_edit_ctrl.cpp
+++ b/src/subs_edit_ctrl.cpp
@@ -56,6 +56,10 @@
#include <wx/menu.h>
#include <wx/settings.h>
+// Maximum number of languages (locales)
+// It should be above 100 (at least 242) and probably not more than 1000
+#define LANGS_MAX 1000
+
/// Event ids
enum {
EDIT_MENU_SPLIT_PRESERVE = 1400,
@@ -73,7 +77,7 @@ enum {
EDIT_MENU_THESAURUS_SUGS,
EDIT_MENU_DIC_LANGUAGE = 1600,
EDIT_MENU_DIC_LANGS,
- EDIT_MENU_THES_LANGUAGE = 1700,
+ EDIT_MENU_THES_LANGUAGE = EDIT_MENU_DIC_LANGUAGE + LANGS_MAX,
EDIT_MENU_THES_LANGS
};
@@ -178,7 +182,7 @@ BEGIN_EVENT_TABLE(SubsTextEditCtrl,wxStyledTextCtrl)
EVT_MENU_RANGE(EDIT_MENU_SUGGESTIONS,EDIT_MENU_THESAURUS-1,SubsTextEditCtrl::OnUseSuggestion)
EVT_MENU_RANGE(EDIT_MENU_THESAURUS_SUGS,EDIT_MENU_DIC_LANGUAGE-1,SubsTextEditCtrl::OnUseSuggestion)
EVT_MENU_RANGE(EDIT_MENU_DIC_LANGS,EDIT_MENU_THES_LANGUAGE-1,SubsTextEditCtrl::OnSetDicLanguage)
- EVT_MENU_RANGE(EDIT_MENU_THES_LANGS,EDIT_MENU_THES_LANGS+100,SubsTextEditCtrl::OnSetThesLanguage)
+ EVT_MENU_RANGE(EDIT_MENU_THES_LANGS,EDIT_MENU_THES_LANGS+LANGS_MAX,SubsTextEditCtrl::OnSetThesLanguage)
END_EVENT_TABLE()
void SubsTextEditCtrl::OnLoseFocus(wxFocusEvent &event) {