+
+ if (Stem::is_normal_stem (stem_)
+ && Stem::duration_log (stem_) > 2
+ && !(unsmob<Grob> (stem_->get_object ("flag"))))
+ {
+ Item *flag = make_item ("Flag", stem_->self_scm ());
+ flag->set_parent (stem_, X_AXIS);
+ stem_->set_object ("flag", flag->self_scm ());
+ maybe_flags_.push_back (flag);
+ }
+ if (tuplet_start_)
+ stem_->set_property ("tuplet-start", SCM_BOOL_T);
+}
+
+void
+Stem_engraver::kill_unused_flags ()
+{
+ for (vsize i = 0; i < maybe_flags_.size (); i++)
+ if (unsmob<Grob> (maybe_flags_[i]->get_parent (X_AXIS)->get_object ("beam")))
+ maybe_flags_[i]->suicide ();
+}
+
+void
+Stem_engraver::finalize ()
+{
+ kill_unused_flags ();