guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Pango attribute deallocated twice


From: Tommi Höynälänmaa
Subject: Re: A Pango attribute deallocated twice
Date: Wed, 6 Jun 2018 16:17:55 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0



Mark H Weaver kirjoitti 05.06.2018 klo 23:28:
Hi,
Sorry, but your expectation here is simply not fulfilled by Guile's
compiler, nor by other modern compilers.  In this case:

   (define-simple-proc make-calculator
       (((lst-panels (:uniform-list <panel>)))
        <none>
        nonpure)
     (console-display-line "*1*")
     (force-output)
     (let* ((attrlist (pango-attr-list-create))
           (tmp1 (begin
                   (console-display-line "*2*")
                   (force-output)
                   0))
           (tmp3 (begin
                   (pango-attr-list-insert
                    attrlist
                    (pango-attr-background-new 65535 0 0))
                   0))

I omitted the rest of this procedure, but it turns out that the only
reference to 'attrlist' is in the initializer for 'tmp3'.  After that,
there's no guarantee that Guile will retain a reference to 'attrlist'.
It probably doesn't.

If you need to artificially keep a reference to some object alive, you
should store it in a top-level variable, or in a data structure that's
referenced by a top-level variable.  Those are never optimized away.

       Mark

Yes, but I think that the attribute still should not be deallocated twice.

     - Tommi Höynälänmaa




reply via email to

[Prev in Thread] Current Thread [Next in Thread]