> On 24. Mar 2018, at 19:22, Eliot Miranda <[email protected]> wrote:
> 

Dear Eliot,


>> d.) Re-write FreeType with Alien and just use the Plugin to conveniently 
>> link/load to freetype..
> 
> I wonder if there is sense in trying to come up with a general memory handle 
> object that includes a session identifier, so that attempts to free stake 
> memory always fail.

I think it would help with the FT2Handle (to invalidate it on a new session) 
but it will not solve other image resume/FFI issues. Let's assume we have 
multiple calls into a C library (get a handle, call 1st method, call 2nd 
method, have a loop with backwards jumps). Something like:


   | memory |
   memory := GetSomeMemorySomewhere.

   1 to: 5 do: [
     self doSomeCStuffWithMemory: memory pointerAndCheckStillValid.
     ... more C stuff
   ].

We could be interrupted at any point and when the execution is resumed the 
handles might be invalid. In Python terminology something like a context 
manager could help:


# Image saving is delayed/inhibited until after the callout chain
CCallOut with: [
   1 to: 5 do: [
     self doSomeCStuffWithMemory: memory pointerAndCheckStillValid.
     ... more C stuff
   ].
]

What do you think?

        holger

Reply via email to