Don't cache history strings in eventDescrArray in history.cc, fixes #4145

This commit is contained in:
heckflosse 2017-10-16 22:18:13 +02:00
parent 43ea69447f
commit 659fa619d4
2 changed files with 5 additions and 16 deletions

View File

@ -24,18 +24,11 @@
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;
Glib::ustring eventDescrArray[NUMOFEVENTS];
History::History (bool bookmarkSupport) : historyVPaned(nullptr), blistener(nullptr), tpc (nullptr), bmnum (1) History::History (bool bookmarkSupport) : historyVPaned(nullptr), blistener(nullptr), tpc (nullptr), bmnum (1)
{ {
blistenerLock = false; // sets default that the Before preview will not be locked blistenerLock = false; // sets default that the Before preview will not be locked
// fill history event message array
for (int i = 0; i < NUMOFEVENTS; i++) {
eventDescrArray[i] = M(Glib::ustring::compose("HISTORY_MSG_%1", i + 1));
}
// History List // History List
// ~~~~~~~~~~~~ // ~~~~~~~~~~~~
Gtk::ScrolledWindow* hscrollw = Gtk::manage (new Gtk::ScrolledWindow ()); Gtk::ScrolledWindow* hscrollw = Gtk::manage (new Gtk::ScrolledWindow ());
@ -238,7 +231,7 @@ void History::procParamsChanged (ProcParams* params, ProcEvent ev, Glib::ustring
} }
// construct formatted list content // construct formatted list content
Glib::ustring text = Glib::ustring::compose ("%1", eventDescrArray[ev]); Glib::ustring text = M("HISTORY_MSG_" + std::to_string(ev + 1));
Glib::RefPtr<Gtk::TreeSelection> selection = hTreeView->get_selection(); Glib::RefPtr<Gtk::TreeSelection> selection = hTreeView->get_selection();
Gtk::TreeModel::iterator iter = selection->get_selected(); Gtk::TreeModel::iterator iter = selection->get_selected();
@ -263,7 +256,6 @@ void History::procParamsChanged (ProcParams* params, ProcEvent ev, Glib::ustring
// if there is no last item or its chev!=ev, create a new one // if there is no last item or its chev!=ev, create a new one
if (size == 0 || !row || row[historyColumns.chev] != ev || ev == EvProfileChanged) { if (size == 0 || !row || row[historyColumns.chev] != ev || ev == EvProfileChanged) {
Gtk::TreeModel::Row newrow = *(historyModel->append()); Gtk::TreeModel::Row newrow = *(historyModel->append());
newrow[historyColumns.realText] = eventDescrArray[ev];
newrow[historyColumns.text] = text; newrow[historyColumns.text] = text;
newrow[historyColumns.value] = g_markup_escape_text(descr.c_str(), -1); newrow[historyColumns.value] = g_markup_escape_text(descr.c_str(), -1);
newrow[historyColumns.chev] = ev; newrow[historyColumns.chev] = ev;
@ -282,7 +274,6 @@ void History::procParamsChanged (ProcParams* params, ProcEvent ev, Glib::ustring
} }
// else just update it // else just update it
else { else {
row[historyColumns.realText] = eventDescrArray[ev];
row[historyColumns.text] = text; row[historyColumns.text] = text;
row[historyColumns.value] = g_markup_escape_text(descr.c_str(), -1); row[historyColumns.value] = g_markup_escape_text(descr.c_str(), -1);
row[historyColumns.chev] = ev; row[historyColumns.chev] = ev;
@ -428,9 +419,9 @@ bool History::on_query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::
if (path && !path.empty()) { if (path && !path.empty()) {
Gtk::TreeModel::iterator iter = historyModel->get_iter(path); Gtk::TreeModel::iterator iter = historyModel->get_iter(path);
if (iter) { if (iter) {
Glib::ustring param, val; Glib::ustring text, val;
iter->get_value<Glib::ustring>(1, param); iter->get_value<Glib::ustring>(0, text);
iter->get_value<Glib::ustring>(2, val); iter->get_value<Glib::ustring>(1, val);
/* /*
* *
@ -449,7 +440,7 @@ bool History::on_query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::
tooltip->set_custom(*hbox); tooltip->set_custom(*hbox);
*/ */
tooltip->set_text(param+" : "+val); tooltip->set_text(text + " : " + val);
displayTooltip = true; displayTooltip = true;
} }
} }

View File

@ -40,7 +40,6 @@ public:
class HistoryColumns : public Gtk::TreeModel::ColumnRecord class HistoryColumns : public Gtk::TreeModel::ColumnRecord
{ {
public: public:
Gtk::TreeModelColumn<Glib::ustring> realText;
Gtk::TreeModelColumn<Glib::ustring> text; Gtk::TreeModelColumn<Glib::ustring> text;
Gtk::TreeModelColumn<Glib::ustring> value; Gtk::TreeModelColumn<Glib::ustring> value;
Gtk::TreeModelColumn<rtengine::procparams::ProcParams> params; Gtk::TreeModelColumn<rtengine::procparams::ProcParams> params;
@ -49,7 +48,6 @@ public:
HistoryColumns() HistoryColumns()
{ {
add(text); add(text);
add(realText);
add(value); add(value);
add(chev); add(chev);
add(params); add(params);