haskell-gi-base-0.26.9: Foundation for libraries generated by haskell-gi

Safe Haskell | None
Language | Haskell2010

Data.GI.Base.GClosure

Description

Some helper functions for dealing with `GClosure`s.

Synopsis

- newtype GClosure a = GClosure (ManagedPtr (GClosure a))
- newGClosure :: MonadIO m => FunPtr a -> m (GClosure a)
- wrapGClosurePtr :: Ptr (GClosure a) -> IO (GClosure a)
- newGClosureFromPtr :: Ptr (GClosure a) -> IO (GClosure a)
- noGClosure :: Maybe (GClosure a)
- unrefGClosure :: (HasCallStack, MonadIO m) => GClosure a -> m ()
- disownGClosure :: GClosure a -> IO (Ptr (GClosure a))

# Documentation

newtype GClosure a Source #

The basic type. This corresponds to a wrapped `GClosure` on the C side, which is a boxed object.

Constructors

GClosure (ManagedPtr (GClosure a)) |

#### Instances

Instances details

GBoxed (GClosure a) Source # | `GClosure`s are registered as boxed in the GLib type system.
Instance details Defined in Data.GI.Base.GClosure
TypedObject (GClosure a) Source # | Find the associated `GType` for the given closure.
Instance details Defined in Data.GI.Base.GClosure Methods glibType :: IO GType Source #
HasParentTypes (GClosure a) Source # |
Instance details Defined in Data.GI.Base.GClosure
type ParentTypes (GClosure a) Source # | There are no types in the bindings that a closure can be safely cast to.
Instance details Defined in Data.GI.Base.GClosure type ParentTypes (GClosure a) = '[] :: [Type]

newGClosure :: MonadIO m => FunPtr a -> m (GClosure a) Source #

Create a new `GClosure` holding the given `FunPtr`. Note that after calling this the `FunPtr` will be freed whenever the `GClosure` is garbage collected, so it is generally not safe to refer to the generated `FunPtr` after this function returns.

wrapGClosurePtr :: Ptr (GClosure a) -> IO (GClosure a) Source #

Take ownership of a passed in `Ptr` to a `GClosure`.

newGClosureFromPtr :: Ptr (GClosure a) -> IO (GClosure a) Source #

Construct a Haskell wrapper for the `GClosure`, without assuming ownership.

noGClosure :: Maybe (GClosure a) Source #

A convenience alias for `Nothing :: Maybe (GClosure a)`.

unrefGClosure :: (HasCallStack, MonadIO m) => GClosure a -> m () Source #

Decrease the reference count of the given `GClosure`. If the reference count reaches 0 the memory will be released.

disownGClosure :: GClosure a -> IO (Ptr (GClosure a)) Source #

Disown (that is, remove from te purview of the Haskell Garbage Collector) the given `GClosure`.