Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer ownership of widgets to C++ when pushed to the QgsMessageBar #350

Merged
merged 1 commit into from Dec 28, 2012

Conversation

m-kuhn
Copy link
Member

@m-kuhn m-kuhn commented Dec 10, 2012

Right now, createMessage transfers ownership of the created widget to python, but when pushed to the message bar, ownership is not transfered back.
This creates the need for python to keep a reference to the message until this gets removed from the messagebar. This is too much overhead for a simple message to be shown.

I'm not sure if the widget needs to be deleted only if its parent is the QgsMessageBar (as in the pull-request now) or in any case, because python will loose ownership anyway and memory will be leaked.

Any help from a sip expert is appreciated.

@ghost ghost assigned wonder-sk Dec 11, 2012
@wonder-sk
Copy link
Member

SIP part looks okay, though QgsMessageBar would probably enjoy some improvements, of course that's not related to this fix.... e.g. the handling of ownerships of objects is not very clear (at least at the first sight), the createMessage() methods should probably have /Factory/ annotation and I see no point in assigning a parent in createMessage() as the widget will be reparented to the message bar.

wonder-sk added a commit that referenced this pull request Dec 28, 2012
Transfer ownership of widgets to C++ when pushed to the QgsMessageBar
@wonder-sk wonder-sk merged commit 5df8f2c into qgis:master Dec 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants