immutable_property_alist_ = basicprops;
mutable_property_alist_ = SCM_EOL;
+ /*
+ We do smobify_self() as the first step. Since the object lives on
+ the heap, none of its SCM variables are protected from GC. After
+ smobify_self(), they are.
+ */
smobify_self ();
original_l_ = (Grob*) &s;
immutable_property_alist_ = s.immutable_property_alist_;
mutable_property_alist_ = SCM_EOL;
+
+ /*
+ No properties are copied. That is the job of handle_broken_dependencies.
+ */
status_c_ = s.status_c_;
pscore_l_ = s.pscore_l_;
smobify_self ();
+
+
}
Grob::~Grob ()
Music::Music (Music const &m)
{
immutable_property_alist_ = m.immutable_property_alist_;
- SCM c =ly_deep_mus_copy (m.mutable_property_alist_);
- mutable_property_alist_ = c;
+ mutable_property_alist_ = SCM_EOL;
+ /*
+ First we smobify_self, then we copy over the stuff. If we don't,
+ stack vars that hold the copy might be optimized away, meaning
+ that they won't be protected from GC.
+ */
smobify_self ();
-
+ mutable_property_alist_ = ly_deep_mus_copy (m.mutable_property_alist_);
set_spot (*m.origin ());
}
void
print_alist (SCM a, SCM port)
{
- for (SCM s = a; gh_pair_p (s); s = ly_cdr (s))
+ /*
+ SCM_EOL -> catch malformed lists.
+ */
+ for (SCM s = a; s != SCM_EOL; s = ly_cdr (s))
{
scm_display (ly_caar (s), port);
scm_puts (" = ", port);
return (s == SCM_BOOL_F) ? SCM_EOL : ly_cdr (s);
}
+void paranoia_check (Music*);
+
void
Music::internal_set_mus_property (SCM s, SCM v)
{
if (internal_type_checking_global_b)
assert (type_check_assignment (s, v, ly_symbol2scm ("music-type?")));
#endif
-
- mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v);
+
+ mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v);
}
+
+
#include "main.hh"
void
SCM_ASSERT_TYPE(sc, mus, SCM_ARG1, __FUNCTION__, "grob");
SCM_ASSERT_TYPE(gh_symbol_p(sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
- return sc->internal_get_mus_property (sym);
-
+ return sc->internal_get_mus_property (sym);
}
LY_DEFINE(ly_set_mus_property,
return SCM_BOOL_T;
}
ADD_MUSIC(Music);
+