Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-zoom-leak into lp:ubuntu-docviewer-app

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Roman Shchekin
Approved revision: 187
Merged at revision: 187
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-zoom-leak
Merge into: lp:ubuntu-docviewer-app
Diff against target: 39 lines (+10/-3)
2 files modified
src/plugin/libreofficetoolkit-qml-plugin/loview.cpp (+6/-1)
src/plugin/libreofficetoolkit-qml-plugin/sgtileitem.cpp (+4/-2)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-zoom-leak
Reviewer Review Type Date Requested Status
Roman Shchekin Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+274125@code.launchpad.net

Commit message

[loview] Fixed leak and tiles that stay visible even after their removal

Description of the change

* [loview] Fixed memory leak
* [loview] Fixed tiles that stay visible even after their removal

I forgot to delete the allocated memory when we remove a tile from the QMap during a zoom event.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Roman Shchekin (mrqtros) wrote :

Great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/loview.cpp'
2--- src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2015-10-11 11:27:29 +0000
3+++ src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2015-10-12 10:54:43 +0000
4@@ -370,7 +370,12 @@
5 for (auto i = m_tiles.begin(); i != m_tiles.end(); ++i)
6 RenderEngine::instance()->dequeueTask(i.value()->id());
7
8- m_tiles.clear();
9+ auto i = m_tiles.begin();
10+ while (i != m_tiles.end()) {
11+ SGTileItem* sgtile = i.value();
12+ sgtile->deleteLater();
13+ i = m_tiles.erase(i);
14+ }
15 }
16
17 LOView::~LOView()
18
19=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/sgtileitem.cpp'
20--- src/plugin/libreofficetoolkit-qml-plugin/sgtileitem.cpp 2015-10-11 11:27:29 +0000
21+++ src/plugin/libreofficetoolkit-qml-plugin/sgtileitem.cpp 2015-10-12 10:54:43 +0000
22@@ -28,13 +28,15 @@
23 QQuickWindow* wnd = window();
24
25 if (!node && wnd && !m_data.isNull()) {
26- QImage image = m_data;
27- auto texture = wnd->createTextureFromImage(image);
28+ auto texture = wnd->createTextureFromImage(m_data);
29 node = new QSGSimpleTextureNode();
30 node->setTexture(texture);
31 node->setOwnsTexture(true);
32 node->setRect(m_area);
33
34+ // We don't need anymore QImage's data
35+ m_data = QImage();
36+
37 #ifdef DEBUG_SHOW_TILE_BORDER
38 drawTileBorders(node);
39 #endif

Subscribers

People subscribed via source and target branches