]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob.cc
(warning): better robustness fix.
[lilypond.git] / lily / grob.cc
index 382cbe2de71742d05c32b45d27aa4594402360ef..f11e52a4fc588bbc6e94a0059870508b6907acdf 100644 (file)
@@ -240,8 +240,11 @@ Grob::get_molecule ()  const
 
   mol =  get_uncached_molecule ();
   
-  Grob *me = (Grob*)this;
-  me->set_grob_property ("molecule", mol);
+  if (live ())
+    {
+      Grob *me = (Grob*)this;
+      me->set_grob_property ("molecule", mol);
+    }
   
   return unsmob_molecule (mol);  
 }
@@ -254,7 +257,6 @@ Grob::get_uncached_molecule ()const
   SCM  mol = SCM_EOL;
   if (gh_procedure_p (proc)) 
     mol = gh_apply (proc, scm_list_n (this->self_scm (), SCM_UNDEFINED));
-
   
   Molecule *m = unsmob_molecule (mol);
   
@@ -372,6 +374,13 @@ Grob::handle_broken_dependencies ()
 void
 Grob::suicide ()
 {
+  if (!live ())
+    return; 
+
+#if 0 // see below. 
+   String nm = name();
+#endif
+  
   mutable_property_alist_ = SCM_EOL;
   immutable_property_alist_ = SCM_EOL;
 
@@ -383,6 +392,19 @@ Grob::suicide ()
       dim_cache_[a].offset_callbacks_ = SCM_EOL;
       dim_cache_[a].offsets_left_ = 0;
     }
+
+#if 0
+  /*
+    This can make debugging a little easier: we can still know what
+    the object used to be. However, since all its links have been
+    broken, it's usually more convenient to set a conditional
+    breakpoint in GDB before the property lists are wiped.
+   */
+  mutable_property_alist_ = scm_acons (ly_symbol2scm ("name"),
+                                      scm_makfrom0str (nm.to_str0()),
+                                      mutable_property_alist_
+                                      );
+#endif
 }
 
 void
@@ -678,9 +700,8 @@ void
 Grob::warning (String s)const
 {
   SCM cause = self_scm();
-  while (cause != SCM_EOL && !unsmob_music (cause))
+  while (Grob * g = unsmob_grob (cause))
     {
-      Grob * g = unsmob_grob (cause);
       cause = g->get_grob_property ("cause");
     }
 
@@ -802,7 +823,7 @@ ly_grobs2scm (Link_array<Grob> a)
 }
 
 
-IMPLEMENT_TYPE_P (Grob, "ly-grob?");
+IMPLEMENT_TYPE_P (Grob, "ly:grob?");
 
 ADD_INTERFACE (Grob, "grob-interface",
   "In music notation, lots of symbols are related in some way.  You can