Revision 4703433...

Go back to digest for 2nd December 2012

Bug Fixes in Educational

Dennis Nienhüser committed changes in [marble/kitchen] src/bindings/python/sip/MarbleWidget.sip:

Fix to Python bindings for addLayer() and removeLayer()

MarbleWidget::addLayer() takes a pointer to a LayerInterface-derived
object as an argument. The pointer is added to an internal list of
layers that are rendered in the Marble widget. When exposing this
function via Python, the /Transfer/ SIP parameter annotation must be
supplied. This notation indicates to SIP that control of the lifetime
of the object passed via addLayer() is placed in the C++ library's
hands. If you don't do this, then Python might decide to
garbage-collect the layer object when it's no longer used on that side.
That is obviously a bad thing if the layer is still being used by the
widget.

Likewise, the /TransferBack/ annotation is used to return ownership of
the object back to Python if the removeLayer() function is later called
to remove the layer from the widget. At that time, the object can
safely be garbage-collected since it is no longer used by the widget
C++ library.

REVIEW: 104655

File Changes

Modified 1 files
  • src/bindings/python/sip/MarbleWidget.sip
1 files changed in total