|
From: | Jean Abou Samra |
Subject: | Re: GC and simple smobs?? |
Date: | Tue, 21 Jun 2022 13:28:09 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
Le 21/06/2022 à 13:21, David Kastrup a écrit :
Jean Abou Samra <jean@abou-samra.fr> writes:To check that, I applied diff --git a/lily/duration-scheme.cc b/lily/duration-scheme.cc index 5d9b4447f1..6a09253adf 100644 --- a/lily/duration-scheme.cc +++ b/lily/duration-scheme.cc @@ -45,6 +45,8 @@ Is @var{p1} shorter than @var{p2}? auto *const a = LY_ASSERT_SMOB (Duration, p1, 1); auto *const b = LY_ASSERT_SMOB (Duration, p2, 2); + scm_gc (); + if (Duration::compare (*a, *b) < 0) return SCM_BOOL_T; else and compiled #(do ((i 0 (1+ i))) ((= i 100)) (ly:duration<? #{ 4 #} #{ 8 #})) No crashes observed.That tells you nothing at all unless you verify that the generated code writes over p1 and p2 before scm_gc is called. This is possible due to optimisation but unlikely.
<facepalm> Correct. Next try: diff --git a/lily/duration-scheme.cc b/lily/duration-scheme.cc index 5d9b4447f1..be75c6ac9d 100644 --- a/lily/duration-scheme.cc +++ b/lily/duration-scheme.cc @@ -45,6 +45,11 @@ Is @var{p1} shorter than @var{p2}? auto *const a = LY_ASSERT_SMOB (Duration, p1, 1); auto *const b = LY_ASSERT_SMOB (Duration, p2, 2); + p1 = SCM_UNDEFINED; + p2 = SCM_UNDEFINED; + + scm_gc (); + if (Duration::compare (*a, *b) < 0) return SCM_BOOL_T; else Does that look better?
[Prev in Thread] | Current Thread | [Next in Thread] |