Skip to content

Commit

Permalink
GUI: Make PredictiveDialog::_btns a fixed size array.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Jan 24, 2016
1 parent c72d95c commit 7c687a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 0 additions & 4 deletions gui/predictivedialog.cpp
Expand Up @@ -70,8 +70,6 @@ enum {
PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
new StaticTextWidget(this, "Predictive.Headline", "Enter Text");

_btns = (ButtonWidget **)calloc(16, sizeof(ButtonWidget *));

_btns[kCancelAct] = new ButtonWidget(this, "Predictive.Cancel", _("Cancel") , 0, kCancelCmd);
_btns[kOkAct] = new ButtonWidget(this, "Predictive.OK", _("Ok") , 0, kOkCmd);
_btns[kBtn1Act] = new ButtonWidget(this, "Predictive.Button1", "1 `-.&" , 0, kBut1Cmd);
Expand Down Expand Up @@ -153,8 +151,6 @@ PredictiveDialog::~PredictiveDialog() {
free(_userDict.dictLine);
free(_predictiveDict.dictLine);
free(_unitedDict.dictLine);

free(_btns);
}

void PredictiveDialog::reflowLayout() {
Expand Down
6 changes: 5 additions & 1 deletion gui/predictivedialog.h
Expand Up @@ -53,6 +53,10 @@ enum ButtonId {
kNoAct = -1
};

enum {
kButtonCount = kBtn0Act + 1
};

enum {
kRepeatDelay = 500
};
Expand Down Expand Up @@ -140,7 +144,7 @@ class PredictiveDialog : public GUI::Dialog {
bool _needRefresh;
private:
EditTextWidget *_edittext;
ButtonWidget **_btns;
ButtonWidget *_btns[kButtonCount];
};

} // namespace GUI
Expand Down

0 comments on commit 7c687a0

Please sign in to comment.