From 7c687a05c7e986d99f459f8efcb7bebcb53514d6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 24 Jan 2016 03:22:26 +0100 Subject: GUI: Make PredictiveDialog::_btns a fixed size array. --- gui/predictivedialog.cpp | 4 ---- gui/predictivedialog.h | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index 627e6c1b96..e7766de586 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -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); @@ -153,8 +151,6 @@ PredictiveDialog::~PredictiveDialog() { free(_userDict.dictLine); free(_predictiveDict.dictLine); free(_unitedDict.dictLine); - - free(_btns); } void PredictiveDialog::reflowLayout() { diff --git a/gui/predictivedialog.h b/gui/predictivedialog.h index a7b7b993cc..c64fcc8264 100644 --- a/gui/predictivedialog.h +++ b/gui/predictivedialog.h @@ -53,6 +53,10 @@ enum ButtonId { kNoAct = -1 }; +enum { + kButtonCount = kBtn0Act + 1 +}; + enum { kRepeatDelay = 500 }; @@ -140,7 +144,7 @@ private: bool _needRefresh; private: EditTextWidget *_edittext; - ButtonWidget **_btns; + ButtonWidget *_btns[kButtonCount]; }; } // namespace GUI -- cgit v1.2.3