diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-12-19 17:07:27 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-12-19 17:07:27 +0000 |
commit | 102081a389a7e7d36bbaaff1a32dec631bb70354 (patch) | |
tree | 573c617b23943db58d205c4fa0b243e7f20341fd /gtk2_ardour/audio_clock.cc | |
parent | 30237aad7f8e56bc97af4f74812e92e76c924258 (diff) |
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
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 18153ac785..c1d256fd02 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -569,28 +569,30 @@ AudioClock::show_edit_status (int length) void AudioClock::start_edit (Field f) { - pre_edit_string = _layout->get_text (); - if (!insert_map.empty()) { - edit_string = pre_edit_string; - } else { - edit_string.clear (); - _layout->set_text (""); - } - - input_string.clear (); - editing = true; - edit_is_negative = false; + if (!editing) { + pre_edit_string = _layout->get_text (); + if (!insert_map.empty()) { + edit_string = pre_edit_string; + } else { + 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 (); - if (f) { - input_string = get_field (f); - show_edit_status (merge_input_and_edit_string ()); - _layout->set_text (edit_string); + Keyboard::magic_widget_grab_focus (); + grab_focus (); } - - queue_draw (); - - Keyboard::magic_widget_grab_focus (); - grab_focus (); } string @@ -1445,7 +1447,7 @@ AudioClock::on_key_press_event (GdkEventKey* ev) if (edit_is_negative) { edit_string.replace(0,1,"-"); } else { - if (pre_edit_string.at(0) == '-') { + if (!pre_edit_string.empty() && (pre_edit_string.at(0) == '-')) { edit_string.replace(0,1,"_"); } else { edit_string.replace(0,1," "); |