prevent crashes in pianoroll when showing velocity

Crash caused by an assumption that all automation has a line
This commit is contained in:
Paul Davis
2025-01-27 10:24:03 -07:00
parent 86f451ecef
commit c4af078acb
5 changed files with 29 additions and 3 deletions

View File

@@ -46,6 +46,13 @@ GhostEvent::~GhostEvent ()
/* event is not ours to delete */
delete item;
}
void
GhostEvent::set_sensitive (bool yn)
{
item->set_ignore_events (!yn);
}
/** Given a note in our parent region (ie the actual MidiRegionView), find our
* representation of it.
* @return Our Event, or 0 if not found.

View File

@@ -22,6 +22,8 @@ class GhostEvent : public sigc::trackable
GhostEvent (::NoteBase *, ArdourCanvas::Container *, ArdourCanvas::Item* i);
virtual ~GhostEvent ();
void set_sensitive (bool yn);
NoteBase* event;
ArdourCanvas::Item* item;
bool is_hit;

View File

@@ -505,11 +505,19 @@ PianorollMidiView::internal_set_active_automation (Evoral::Parameter const & par
for (CueAutomationMap::iterator i = automation_map.begin(); i != automation_map.end(); ++i) {
if (i->first == param) {
i->second.line->set_sensitive (true);
if (i->second.line) {
/* velocity does not have a line */
i->second.line->set_sensitive (true);
} else {
}
active_automation = &i->second;
exists = true;
} else {
i->second.line->set_sensitive (false);
if (i->second.line) {
i->second.line->set_sensitive (false);
} else {
i->second.velocity_display->set_sensitive (false);
}
}
}
@@ -658,4 +666,3 @@ PianorollMidiView::clear_selection ()
i->second.line->set_selected_points (empty);
}
}

View File

@@ -156,6 +156,14 @@ VelocityDisplay::clear ()
_optimization_iterator = events.end();
}
void
VelocityDisplay::set_sensitive (bool yn)
{
for (auto & ev : events) {
ev.second->set_sensitive (yn);
}
}
void
VelocityDisplay::add_note (NoteBase* nb)
{

View File

@@ -65,6 +65,8 @@ class VelocityDisplay
int y_position_to_velocity (double y) const;
void set_sensitive (bool yn);
void set_selected (bool);
bool line_draw_motion (ArdourCanvas::Duple const & d, ArdourCanvas::Rectangle const & r, double last_x);