- if (mus->get_outlet ())
- scm_gc_mark (mus->get_outlet ()->self_scm ());
- if (mus->music_)
- scm_gc_mark (mus->music_->self_scm ());
+ /* Use handle_ directly as get_outlet is a virtual function and we
+ need to protect the context until Music_iterator::quit is being
+ run. */
+ if (handle_.get_context ())
+ scm_gc_mark (handle_.get_context ()->self_scm ());
+ if (music_)
+ scm_gc_mark (music_->self_scm ());