Sun Nov 22 13:52:55 EST 2009 Axel Simon <Axe...@en...>
* Move the weak reference function to disallow weak references from GObjects.
hunk ./Makefile.am 842
+ gtk/Graphics/UI/Gtk/Abstract/Object_stub.o \
hunk ./glib/System/Glib/GObject.chs.pp 50
- -- ** Weak references
- GWeakNotify,
- objectWeakref,
- objectWeakunref,
-
hunk ./glib/System/Glib/GObject.chs.pp 146
-mkFunPtrDestroyNotify hPtr = do
- dRef <- newIORef nullFunPtr
- dPtr <- mkDestroyNotifyPtr $ do
- freeHaskellFunPtr hPtr
- dPtr <- readIORef dRef
- freeHaskellFunPtr dPtr
- writeIORef dRef dPtr
- return dPtr
-
-{#pointer GWeakNotify#}
-
-foreign import ccall "wrapper" mkDestructor :: IO () -> IO GWeakNotify
+mkFunPtrDestroyNotify hPtr = return freeCallbackFunPtr
hunk ./glib/System/Glib/GObject.chs.pp 148
--- | Attach a callback that will be called after the
--- destroy hooks have been called
---
-objectWeakref :: GObjectClass o => o -> IO () -> IO GWeakNotify
-objectWeakref obj uFun = do
- funPtrContainer <- newIORef nullFunPtr
- uFunPtr <- mkDestructor $ do
- uFun
- funPtr <- readIORef funPtrContainer
- freeHaskellFunPtr funPtr
- writeIORef funPtrContainer uFunPtr
- {#call unsafe object_weak_ref#} (toGObject obj) uFunPtr nullPtr
- return uFunPtr
-
--- | Detach a weak destroy callback function
---
-objectWeakunref :: GObjectClass o => o -> GWeakNotify -> IO ()
-objectWeakunref obj fun = [_$_]
- {#call unsafe object_weak_unref#} (toGObject obj) fun nullPtr
+foreign import ccall unsafe "&freeHaskellFunctionPtr" freeCallbackFunPtr :: DestroyNotify
|