# # # patch "ChangeLog" # from [df260271c566f7e7352afe42a37cb4ca7a6ea7d6] # to [814cf493137f143575d738ee79c5723f7b9aa3f1] # # patch "annotate.cc" # from [7dfd28efca637d76828c1d85b35b888eba9a7869] # to [dc5051843ce6406acbf2fadf151e9e9d52a36946] # ============================================================ --- ChangeLog df260271c566f7e7352afe42a37cb4ca7a6ea7d6 +++ ChangeLog 814cf493137f143575d738ee79c5723f7b9aa3f1 @@ -1,3 +1,10 @@ +2006-12-04 Thomas Moschny + + * annotate.cc: Bugfix: the heights index in the + multi_index_container was using the wrong sort order. + * annotate.cc (do_annotate): Calling do_annotate_node() might + invalidate the iterator pointing to the current work unit. + 2006-12-02 Thomas Moschny * annotate.cc (do_annotate, do_annotate_node): Use a ============================================================ --- annotate.cc 7dfd28efca637d76828c1d85b35b888eba9a7869 +++ annotate.cc dc5051843ce6406acbf2fadf151e9e9d52a36946 @@ -180,9 +180,12 @@ typedef multi_index_container< typedef multi_index_container< annotate_node_work, indexed_by< - ordered_unique >, - ordered_unique, - member > + ordered_unique< + member, + std::greater >, + ordered_unique< + tag, + member > > > work_units; @@ -804,10 +807,16 @@ do_annotate (app_state &app, file_t file while (!(work_units.empty() || acp->is_complete())) { - work_units::iterator work = work_units.begin(); - I(work != work_units.end()); - do_annotate_node(*work, app, work_units); - work_units.erase(work); + // get the work unit for the revision with the greatest height + work_units::iterator w = work_units.begin(); + I(w != work_units.end()); + + // do_annotate_node() might insert new work units into work_units, and + // thus might invalidate the iterator + annotate_node_work work = *w; + work_units.erase(w); + + do_annotate_node(work, app, work_units); } acp->annotate_equivalent_lines();