]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4304: Smob code changes mostly relevant for multithreading
authorMark H Weaver <mhw@netris.org>
Sun, 1 Mar 2015 14:07:30 +0000 (15:07 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 6 Mar 2015 08:51:52 +0000 (09:51 +0100)
These changes have been suggested by Mark H Weaver in
<URL:http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19883#41>

Signed-off-by: David Kastrup <dak@gnu.org>
lily/include/smobs.hh

index a816b67ca3df9e0f0f2228e5729102c06d0e0036..3ee2ef80abce09b44b2acadf1081173eb6579ce6 100644 (file)
@@ -266,21 +266,22 @@ public:
   }
   SCM unprotected_smobify_self ()
   {
-    self_scm_ = Smob_base<Super>::register_ptr (static_cast<Super *> (this));
-    return self_scm_;
+    SCM s = Smob_base<Super>::register_ptr (static_cast<Super *> (this));
+    self_scm_ = s;
+    return s;
   }
   void protect ()
   {
     protect_smob (self_scm_, &protection_cons_);
   }
+  void smobify_self () {
+    protect_smob (unprotected_smobify_self (), &protection_cons_);
+  }
   SCM unprotect ()
   {
-    unprotect_smob (self_scm_, &protection_cons_);
-    return self_scm_;
-  }
-  void smobify_self () {
-    self_scm_ = unprotected_smobify_self ();
-    protect ();
+    SCM s = self_scm_;
+    unprotect_smob (s, &protection_cons_);
+    return s;
   }
   SCM self_scm () const { return self_scm_; }
 };