changeset 12259:40be4f07b3b5 release-3-4-x

input.cc (input_event_hook): fix incorrect use of iterator
author John W. Eaton <jwe@octave.org>
date Thu, 27 Jan 2011 04:26:39 -0500
parents 077ece977a7b
children 5f1bb7aa3a3a
files src/ChangeLog src/input.cc
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-27  John W. Eaton  <jwe@octave.org>
+
+	* input.cc (input_event_hook): Fix incorrect use of iterator.
+	Reported by Pascal Dupuis <Pascal.Dupuis@worldonline.be>.
+
 2011-01-27  John W. Eaton  <jwe@octave.org>
 
 	* ov-class.cc (octave_class::reconstruct_exemplar):
--- a/src/input.cc
+++ b/src/input.cc
@@ -1255,7 +1255,7 @@
           std::string hook_fcn = p->first;
           octave_value user_data = p->second;
 
-          p++;
+          hook_fcn_map_type::iterator q = p++;
 
           if (is_valid_function (hook_fcn))
             {
@@ -1265,7 +1265,7 @@
                 feval (hook_fcn, octave_value_list (), 0);
             }
           else
-            hook_fcn_map.erase (p);
+            hook_fcn_map.erase (q);
         }
 
       if (hook_fcn_map.empty ())