-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fixes for memory leaks and QObject* ownership bugs #201
base: master
Are you sure you want to change the base?
Conversation
Due to returning QObject* in calls to C++ objects from QML (e.g. getItem(i)), those objects were changing ownership to QML and were subject to gc. That could've been noticed during switching between journey results and journey details results (instantly switch back and forth to create enough garbage). `var item = result.getItem(i);` `item` would be null after some time. So it was ending up in page showing loader and not doing anything or in a bit more rare cases with segfault.
Requires: | ||
- sailfishsilica-qt5 >= 0.10.9 | ||
- qt5-qtdeclarative-import-positioning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my guess is, this also auto installs the position lib in emulator.
Only worry is, that this also get catched by harbour store validator :) (as far as i know using gps is still against the harbour rules)
If you have any insights on this, or should we wait and see? :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this change relevant to QObject
ownership change at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that change got there by mistake mostly, but w/o it you can not run it in emu w/o manually installing packages. it can also affect users, which have no positioning dependant apps installed (if that is possible at all :))
that said, that change can be undone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, QtPositioning is now allowed in Harbour (since 6th of May)
https://together.jolla.com/question/11446/support-for-qtpositioning-qtlocation-apis/?answer=87430#post-id-87430
It looks like we were leaking memory after each search before, and will be leaking even more with this change. At the end everything gets parented to |
This changes wasn't intented to fix memory leaks in c++ part of the app. |
Not completely true. |
I was talking about a generic way. |
Not sure. All of the classes in the created object tree inherit from A more proper solution would, of course, be destructors that call I was referring to this particular case and your change. The one-liner I suggest would already prevent quite a big leak. I'm pretty sure that there are other places where we leak memory and they need to be investigated, too. |
Due to returning QObject* in calls to C++ objects from QML (e.g. getItem(i)), those objects were changing ownership to QML and were subject to gc. That could've been noticed during switching between journey results and journey details results (instantly switch back and forth to create enough garbage). `var item = result.getItem(i);` `item` would be null after some time. So it was ending up in page showing loader and not doing anything or in a bit more rare cases with segfault.
…rplan into qt-qml-fixing-ownership-rebased
…ml-fixing-ownership-rebased
(cherry picked from commit 177a939)
@smurfy seems like at this point I better stop :) I've done more or less basic checks, no segfaults during that period. though there is plenty of things to improve, for this pr there are too many commmits already. |
there is a regression in hafas parser, which I will adress in next commit. |
seems to be it for this PR :) |
this is PR is definately needed for Ubuntu touch, without it the app crashes if you switch between the connections overview and the connections details for a few times. |
Due to returning QObject* in calls to C++ objects from QML (e.g.
getItem(i)), those objects were changing ownership to QML and were
subject to gc. That could've been noticed during switching between
journey results and journey details results (instantly switch back and
forth to create enough garbage).
var item = result.getItem(i);
item
would be null after some time. So it was ending up in pageshowing loader and not doing anything or in a bit more rare cases with
segfault.