Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(857)

Unified Diff: lily/include/smobs.tcc

Issue 197690043: Various fixes/improvements in connection with Smob allocation (Closed)
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lily/include/small-smobs.hh ('k') | lily/music-function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lily/include/smobs.tcc
diff --git a/lily/include/smobs.tcc b/lily/include/smobs.tcc
index c0a62535f5e4f830200c8b4a249ae955032d414f..b4dacacaa325ec8759bf321e368b4c8e138cc0ff 100644
--- a/lily/include/smobs.tcc
+++ b/lily/include/smobs.tcc
@@ -32,14 +32,20 @@ template <class Super>
SCM
Smob_base<Super>::mark_trampoline (SCM arg)
{
- return (Super::unsmob (arg))->mark_smob ();
+ Super *ptr = Super::unsmob (arg);
+ if (ptr)
+ return ptr->mark_smob ();
+ return SCM_UNDEFINED;
}
template <class Super>
int
Smob_base<Super>::print_trampoline (SCM arg, SCM port, scm_print_state *p)
{
- return (Super::unsmob (arg))->print_smob (port, p);
+ Super *ptr = Super::unsmob (arg);
+ if (ptr)
+ return ptr->print_smob (port, p);
+ return 0;
}
template <class Super>
@@ -96,6 +102,7 @@ Smob_base<Super>::unregister_ptr (SCM obj)
{
Super *p = Super::unchecked_unsmob (obj);
scm_gc_unregister_collectable_memory (p, sizeof (*p), smob_name_.c_str ());
+ SCM_SET_SMOB_DATA (obj, static_cast<Super *> (0));
return p;
}
« no previous file with comments | « lily/include/small-smobs.hh ('k') | lily/music-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b