From: <du...@co...> - 2009-10-31 14:02:09
|
Sat Oct 31 09:58:49 EDT 2009 Duncan Coutts <du...@ha...> * Fix C-side memory leaks in functions that take a GList Ignore-this: 8703764bb7a8314d9d7dd0ec5f42836e The C functions do not take ownership of the GList (they make a copy) It is the responsibility of the caller to allocate and free the GList. hunk ./glib/System/Glib/GList.chs 35 + withGList, + hunk ./glib/System/Glib/GList.chs 137 +-- Temporarily allocate a list of something +-- +withGList :: [Ptr a] -> (GSList -> IO b) -> IO b +withGList xs = bracket (toGList xs) {# call unsafe g_list_free #} + hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 205 -import System.Glib.GList (fromGList, toGList) +import System.Glib.GList (fromGList, withGList) hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 315 - withForeignPtrs (map unWidget chain) $ \wPtrs -> do - glist <- toGList wPtrs + withForeignPtrs (map unWidget chain) $ \wPtrs -> + withGList wPtrs $ \glist -> hunk ./gtk/Graphics/UI/Gtk/Windows/Invisible.chs.pp 59 -import System.Glib.GList (fromGList, toGList) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 241 -import System.Glib.GList (fromGList, toGList) +import System.Glib.GList (fromGList, withGList) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1233 - withForeignPtrs (map unPixbuf list) $ \ptrList -> do - glist <- toGList ptrList + withForeignPtrs (map unPixbuf list) $ \ptrList -> + withGList ptrList $ \glist -> hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1255 - withForeignPtrs (map unPixbuf list) $ \ptrList -> do - glist <- toGList ptrList + withForeignPtrs (map unPixbuf list) $ \ptrList -> + withGList ptrList $ \glist -> hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2163 + hunk ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs 53 -import System.Glib.GList (fromGList, toGList) +import System.Glib.GList (fromGList) |