13
0

fix crash reported by colinf when editing via >1 click on an audioclock. this caused pre_edit_string to be reset to an empty string on the non-first clicks, and then string::at() was used on it. both aspects fixed

git-svn-id: svn://localhost/ardour2/branches/3.0@13682 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-12-19 17:07:27 +00:00
parent 30237aad7f
commit 102081a389

View File

@ -569,28 +569,30 @@ AudioClock::show_edit_status (int length)
void void
AudioClock::start_edit (Field f) AudioClock::start_edit (Field f)
{ {
pre_edit_string = _layout->get_text (); if (!editing) {
if (!insert_map.empty()) { pre_edit_string = _layout->get_text ();
edit_string = pre_edit_string; if (!insert_map.empty()) {
} else { edit_string = pre_edit_string;
edit_string.clear (); } else {
_layout->set_text (""); edit_string.clear ();
_layout->set_text ("");
}
input_string.clear ();
editing = true;
edit_is_negative = false;
if (f) {
input_string = get_field (f);
show_edit_status (merge_input_and_edit_string ());
_layout->set_text (edit_string);
}
queue_draw ();
Keyboard::magic_widget_grab_focus ();
grab_focus ();
} }
input_string.clear ();
editing = true;
edit_is_negative = false;
if (f) {
input_string = get_field (f);
show_edit_status (merge_input_and_edit_string ());
_layout->set_text (edit_string);
}
queue_draw ();
Keyboard::magic_widget_grab_focus ();
grab_focus ();
} }
string string
@ -1445,7 +1447,7 @@ AudioClock::on_key_press_event (GdkEventKey* ev)
if (edit_is_negative) { if (edit_is_negative) {
edit_string.replace(0,1,"-"); edit_string.replace(0,1,"-");
} else { } else {
if (pre_edit_string.at(0) == '-') { if (!pre_edit_string.empty() && (pre_edit_string.at(0) == '-')) {
edit_string.replace(0,1,"_"); edit_string.replace(0,1,"_");
} else { } else {
edit_string.replace(0,1," "); edit_string.replace(0,1," ");