Skip to content

Commit

Permalink
Merge pull request #208 from kanurag94/master
Browse files Browse the repository at this point in the history
Fix Crash on playing XaoS tutorials
  • Loading branch information
kanurag94 authored Jan 16, 2021
2 parents 06d2df9 + 188a79e commit ac59509
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/include/xmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef char *(*tokenfunc)(struct uih_context *c);
#define DIALOG_PALSLIDER 10
#define DIALOG_PALPICKER 11
#define DIALOG_IFILES 12
#define DIALOG_ILIST 13
#define DIALOG_LIST 13

#define DIALOGIFILE(question, filename) \
{ \
Expand Down Expand Up @@ -80,6 +80,10 @@ typedef char *(*tokenfunc)(struct uih_context *c);
{ \
question, DIALOG_IFILES, 0, filenames \
}
#define DIALOGLIST(question, default) \
{ \
question, DIALOG_LIST, 0, default \
}

#define DIALOGIFILE_I(_question, _filename) \
menudialogs_i18n[no_menudialogs_i18n].question = _question; \
Expand Down Expand Up @@ -166,9 +170,9 @@ typedef char *(*tokenfunc)(struct uih_context *c);
menudialogs_i18n[no_menudialogs_i18n].defstr = _filenames; \
++no_menudialogs_i18n;

#define DIALOGILIST_I(_question, _default) \
#define DIALOGLIST_I(_question, _default) \
menudialogs_i18n[no_menudialogs_i18n].question = _question; \
menudialogs_i18n[no_menudialogs_i18n].type = DIALOG_ILIST; \
menudialogs_i18n[no_menudialogs_i18n].type = DIALOG_LIST; \
menudialogs_i18n[no_menudialogs_i18n].defint = 0; \
menudialogs_i18n[no_menudialogs_i18n].defstr = _default; \
++no_menudialogs_i18n;
Expand Down
2 changes: 1 addition & 1 deletion src/ui-hlp/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void uih_registermenudialogs_i18n(void)

#ifdef USE_SFFE
Register(uih_sffedialog);
DIALOGILIST_I(TR("Dialog", "Formula"), USER_FORMULA);
DIALOGLIST_I(TR("Dialog", "Formula"), USER_FORMULA);
NULL_I();

Register(uih_sffeinitdialog);
Expand Down
4 changes: 2 additions & 2 deletions src/ui/customdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ CustomDialog::CustomDialog(struct uih_context *uih, const menuitem *item,
formLayout->addRow(layout2);
formLayout->addRow(layout3);

} else if (dialog[i].type == DIALOG_ILIST) {
} else if (dialog[i].type == DIALOG_LIST) {

QComboBox *list = new QComboBox(this);
list->setObjectName(label);
Expand Down Expand Up @@ -316,7 +316,7 @@ void CustomDialog::accept()
destroypalette(gradientpal);
} else if (m_dialog[i].type == DIALOG_PALPICKER) {
mkcustompalette(palcontext->image->palette, newColors);
} else if (m_dialog[i].type == DIALOG_ILIST) {
} else if (m_dialog[i].type == DIALOG_LIST) {
QComboBox *list = findChild<QComboBox *>(label);
m_parameters[i].dstring = strdup(list->currentText().toUtf8());
}
Expand Down
3 changes: 2 additions & 1 deletion src/util/xmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ void menu_activate(const menuitem *item, struct uih_context *c, dialogparam *d)
break;
case DIALOG_STRING:
case DIALOG_KEYSTRING:
case DIALOG_ILIST:
case DIALOG_LIST:
((void (*)(struct uih_context * c, char *))
item->function)(c, d[0].dstring);
break;
Expand Down Expand Up @@ -528,6 +528,7 @@ const char *menu_fillparam(struct uih_context *uih, tokenfunc f,
p->dstring = mystrdup(c);
break;
case DIALOG_STRING:
case DIALOG_LIST:
if (menuparse_scheme) {
int l = strlen(c);
if (l < 2 || c[0] != '"' || c[l - 1] != '"')
Expand Down

0 comments on commit ac59509

Please sign in to comment.