changeset 21094:622e34f6ede3

Fix segfault with dbstatus (bug #44195) * debug.cc (bp_table::do_get_breakpoint_list): Copy bp_set to temporary variable and iterate over that since changes to a file may invalidate bp_set while code is running..
author Lachlan Andrew <lachlanbis@gmail.com>
date Sun, 17 Jan 2016 07:37:49 -0800
parents 0ebb8e26ebbc
children d6fa72047aeb
files libinterp/corefcn/debug.cc
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/debug.cc	Sun Jan 17 07:22:55 2016 -0800
+++ b/libinterp/corefcn/debug.cc	Sun Jan 17 07:37:49 2016 -0800
@@ -516,7 +516,10 @@
 {
   fname_line_map retval;
 
-  for (bp_set_iterator it = bp_set.begin (); it != bp_set.end (); it++)
+  // make copy since changes may invalidate iters of bp_set.
+  std::set<std::string> tmp_bp_set = bp_set;
+
+  for (bp_set_iterator it = tmp_bp_set.begin (); it != tmp_bp_set.end (); it++)
     {
       if (fname_list.length () == 0
           || do_find_bkpt_list (fname_list, *it) != "")