13
0

Fix segfault when undoing marker deletion

find_location_markers() may return NULL.
This also consolidates code from acc55083e5
This commit is contained in:
Robin Gareus 2023-08-30 20:46:20 +02:00
parent aaff022fd2
commit 797c362500
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -663,21 +663,19 @@ Editor::update_section_rects ()
double const left = sample_to_pixel (start.samples ()); double const left = sample_to_pixel (start.samples ());
double const right = sample_to_pixel (end.samples ()); double const right = sample_to_pixel (end.samples ());
Editor::LocationMarkers* markers = find_location_markers (l);
ArdourCanvas::Rectangle* rect = new ArdourCanvas::Rectangle (section_marker_bar, ArdourCanvas::Rect (left, 1, right, timebar_height)); ArdourCanvas::Rectangle* rect = new ArdourCanvas::Rectangle (section_marker_bar, ArdourCanvas::Rect (left, 1, right, timebar_height));
rect->set_fill (true); rect->set_fill (true);
rect->set_outline_what(ArdourCanvas::Rectangle::What(0)); rect->set_outline_what(ArdourCanvas::Rectangle::What(0));
rect->raise_to_top (); rect->raise_to_top ();
if (bright) {
markers->set_color("arrangement rect"); std::string const color = bright ? "arrangement rect" : "arrangement rect alt";
rect->set_fill_color (UIConfiguration::instance().color ("arrangement rect")); rect->set_fill_color (UIConfiguration::instance().color (color));
} else {
markers->set_color("arrangement rect alt"); Editor::LocationMarkers* markers = find_location_markers (l);
rect->set_fill_color (UIConfiguration::instance().color ("arrangement rect alt")); if (markers) {
markers->set_color (color);
} }
bright = !bright; bright = !bright;
} }
} while (l); } while (l);
} }