ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #05244
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-zoom-leak into lp:ubuntu-docviewer-app/reboot
Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-zoom-leak into lp:ubuntu-docviewer-app/reboot.
Commit message:
[loview] Fixed leak and tiles that stay visible even after their removal
Requested reviews:
Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)
For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-zoom-leak/+merge/274125
* [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.
--
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-zoom-leak into lp:ubuntu-docviewer-app/reboot.
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/loview.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2015-10-11 11:27:29 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2015-10-12 10:54:43 +0000
@@ -370,7 +370,12 @@
for (auto i = m_tiles.begin(); i != m_tiles.end(); ++i)
RenderEngine::instance()->dequeueTask(i.value()->id());
- m_tiles.clear();
+ auto i = m_tiles.begin();
+ while (i != m_tiles.end()) {
+ SGTileItem* sgtile = i.value();
+ sgtile->deleteLater();
+ i = m_tiles.erase(i);
+ }
}
LOView::~LOView()
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/sgtileitem.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/sgtileitem.cpp 2015-10-11 11:27:29 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/sgtileitem.cpp 2015-10-12 10:54:43 +0000
@@ -28,13 +28,15 @@
QQuickWindow* wnd = window();
if (!node && wnd && !m_data.isNull()) {
- QImage image = m_data;
- auto texture = wnd->createTextureFromImage(image);
+ auto texture = wnd->createTextureFromImage(m_data);
node = new QSGSimpleTextureNode();
node->setTexture(texture);
node->setOwnsTexture(true);
node->setRect(m_area);
+ // We don't need anymore QImage's data
+ m_data = QImage();
+
#ifdef DEBUG_SHOW_TILE_BORDER
drawTileBorders(node);
#endif
References