View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004823 | ardour | bugs | public | 2012-04-05 00:34 | 2020-04-19 20:16 |
Reporter | ahurst | Assigned To | cth103 | ||
Priority | normal | Severity | major | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Product Version | 3.0-beta3 | ||||
Target Version | 3.0 | ||||
Summary | 0004823: Invalidated iterator used | ||||
Description | Medium impact static analysis bug: An iterator is invalidated and then subsequently used at gtk2_ardour/tempo_lines.cc:242. Need to keep a copy of next valid iterator before erasing current. | ||||
Additional Information | *** "erase" invalidates iterator "steal". 233 _lines.erase(steal); 234 line->property_color_rgba() = color; 235 line->property_x1() = xpos; 236 line->property_x2() = xpos; 237 _lines.insert(make_pair(xpos, line)); 238 inserted_last_time = true; // search next time 239 invalidated = true; 240 241 // Shift clean range right *** Using invalid iterator "steal". 242 _clean_left = max(_clean_left, steal->first); | ||||
Tags | No tags attached. | ||||
|
I am not sure for this patch but it can be a solution. Sorry for the name of the patch. |
2012-04-09 14:06
|
bug4823 (735 bytes)
Index: tempo_lines.cc =================================================================== --- tempo_lines.cc (révision 11787) +++ tempo_lines.cc (copie de travail) @@ -229,6 +229,7 @@ //cout << "*** STEALING FROM LEFT" << endl; assert(_lines.find(xpos) == _lines.end()); Lines::iterator steal = _lines.begin(); + Lines::iterator save_steal = _lines.begin(); line = steal->second; _lines.erase(steal); line->property_color_rgba() = color; @@ -239,8 +240,9 @@ invalidated = true; // Shift clean range right - _clean_left = max(_clean_left, steal->first); + _clean_left = max(_clean_left, save_steal->first); _clean_right = max(_clean_right, xpos); + _lines.erase(save_steal); } } |
2012-04-09 14:08
|
bug4823.patch (735 bytes)
Index: tempo_lines.cc =================================================================== --- tempo_lines.cc (révision 11787) +++ tempo_lines.cc (copie de travail) @@ -229,6 +229,7 @@ //cout << "*** STEALING FROM LEFT" << endl; assert(_lines.find(xpos) == _lines.end()); Lines::iterator steal = _lines.begin(); + Lines::iterator save_steal = _lines.begin(); line = steal->second; _lines.erase(steal); line->property_color_rgba() = color; @@ -239,8 +240,9 @@ invalidated = true; // Shift clean range right - _clean_left = max(_clean_left, steal->first); + _clean_left = max(_clean_left, save_steal->first); _clean_right = max(_clean_right, xpos); + _lines.erase(save_steal); } } |
|
The element pointed to by "save_steal" will be erased when "steal" is erased. |
2012-04-10 14:37
|
bug_4823_v2.patch (710 bytes)
Index: gtk2_ardour/tempo_lines.cc =================================================================== --- gtk2_ardour/tempo_lines.cc (révision 11860) +++ gtk2_ardour/tempo_lines.cc (copie de travail) @@ -230,6 +230,7 @@ //cout << "*** STEALING FROM LEFT" << endl; assert(_lines.find(xpos) == _lines.end()); Lines::iterator steal = _lines.begin(); + double save = steal->first; line = steal->second; _lines.erase(steal); line->property_color_rgba() = color; @@ -240,7 +241,7 @@ invalidated = true; // Shift clean range right - _clean_left = max(_clean_left, steal->first); + _clean_left = max(_clean_left, save); _clean_right = max(_clean_right, xpos); } } |
|
Certainly better like that :). |
|
Patch applied to SVN 11889, thanks! |
|
Issue has been closed automatically, by Trigger Close Plugin. Feel free to re-open with additional information if you think the issue is not resolved. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-04-05 00:34 | ahurst | New Issue | |
2012-04-05 01:05 | cth103 | cost | => 0.00 |
2012-04-05 01:05 | cth103 | Target Version | => 3.0 beta4 |
2012-04-09 14:03 | epitech_user | Note Added: 0013094 | |
2012-04-09 14:06 | epitech_user | File Added: bug4823 | |
2012-04-09 14:08 | epitech_user | File Added: bug4823.patch | |
2012-04-09 14:09 | epitech_user | Note Edited: 0013094 | |
2012-04-09 22:31 | ahurst | Note Added: 0013100 | |
2012-04-10 14:37 | epitech_user | File Added: bug_4823_v2.patch | |
2012-04-10 14:38 | epitech_user | Note Added: 0013103 | |
2012-04-11 10:08 | cth103 | Note Added: 0013108 | |
2012-04-11 10:08 | cth103 | Status | new => resolved |
2012-04-11 10:08 | cth103 | Resolution | open => fixed |
2012-04-11 10:08 | cth103 | Assigned To | => cth103 |
2012-05-23 15:08 | cth103 | Target Version | 3.0 beta4 => 3.0 |
2020-04-19 20:16 | system | Note Added: 0023032 | |
2020-04-19 20:16 | system | Status | resolved => closed |