Invalidate iterator whenever model changes.

I suspect this is an underlying cause of several tricky to reproduce bugs, but
we'll have to wait around and see...
This commit is contained in:
David Robillard 2014-12-06 18:04:30 -05:00
parent 2ea4ae603a
commit eb86971d2d
2 changed files with 6 additions and 0 deletions

View file

@ -397,6 +397,7 @@ void
MidiSource::drop_model () MidiSource::drop_model ()
{ {
_model.reset(); _model.reset();
invalidate();
ModelChanged (); /* EMIT SIGNAL */ ModelChanged (); /* EMIT SIGNAL */
} }
@ -404,6 +405,7 @@ void
MidiSource::set_model (boost::shared_ptr<MidiModel> m) MidiSource::set_model (boost::shared_ptr<MidiModel> m)
{ {
_model = m; _model = m;
invalidate();
ModelChanged (); /* EMIT SIGNAL */ ModelChanged (); /* EMIT SIGNAL */
} }

View file

@ -613,6 +613,8 @@ SMFSource::load_model (bool lock, bool force_reload)
_model->clear(); _model->clear();
} }
invalidate();
if (writable() && !_open) { if (writable() && !_open) {
return; return;
} }
@ -712,6 +714,7 @@ SMFSource::destroy_model ()
{ {
//cerr << _name << " destroying model " << _model.get() << endl; //cerr << _name << " destroying model " << _model.get() << endl;
_model.reset(); _model.reset();
invalidate();
} }
void void
@ -753,6 +756,7 @@ SMFSource::ensure_disk_file ()
_model.reset (); _model.reset ();
mm->sync_to_source (); mm->sync_to_source ();
_model = mm; _model = mm;
invalidate();
} else { } else {
/* No model; if it's not already open, it's an empty source, so create /* No model; if it's not already open, it's an empty source, so create
and open it for writing. and open it for writing.