> I've worked it out. With a little help from malcolmw on #ghc.

Excellent!  Thanks very much.  I learned something new.

> Should imageGetData be turned into a 'with-style' function
> 
> Image a -> (Ptr () -> IO b) -> IO b
> 
> which protects the image?

Ultimately, this seems like the right thing to do, for all functions
that return pointers to underlying bits of data (I am slightly scared
that there may be loads of these lurking around).

> Is there a workaround I can use in my code like touchPtr? A version of 
> touchPtr which works on WXObjects?

Well, I added image `seq` return () to your demonstrator.  Not sure if
that really does what we want.  I suppose we could augment the
PixelBuffer type to include a pointer to the original image.

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9

Attachment: pgpn8GDOQIRja.pgp
Description: PGP signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to