Commit 4cd167f0 authored by Christoph Reiter's avatar Christoph Reiter 馃悕

docs: document GObject.Object.weak_ref(). Fixes #245

parent e6e05277
......@@ -6,7 +6,7 @@ all: _build
images/%.svg: images/%.dia
dia $< --export=$@ --filter=dia-svg
_build: Makefile *.rst devguide/*.rst guide/*.rst images/*.png $(DIA_SVGS) ../README.rst ../NEWS
_build: Makefile *.rst devguide/*.rst guide/*/*.rst guide/*.rst images/*.png $(DIA_SVGS) ../README.rst ../NEWS
sphinx-build -b html . _build
......@@ -22,6 +22,7 @@ In addition :obj:`GObject.Object` has support for :any:`signals <signals>` and
Weak References
While Python has a builtin ``weakref`` module it only allows one to create
weak references to Python objects, but with PyGObject the Python object
"wrapping" a GObject and the GObject itself might not have the same lifetime.
The wrapper can get garbage collected and a new wrapper created again at a
later point.
If you want to get notified when the underlying GObject gets finalized use
.. method:: GObject.Object.weak_ref(callback, *user_data)
Registers a callback to be called when the underlying GObject gets
finalized. The callback will receive the give `user_data`.
To unregister the callback call the ``unref()`` method of the returned
GObjectWeakRef object.
:param callback: A callback which will be called when the object
is finalized
:type callback: :func:`callable`
:param user_data: User data that will be passed to the callback
:returns: GObjectWeakRef
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment