Skip to content
  • Jason Roehm's avatar
    Fix to Python bindings for addLayer() and removeLayer() · b41a90bc
    Jason Roehm authored
    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
    b41a90bc