Memory leak in QSGBatchRenderer::Renderer::map() (QTBUG-48799)

This commit is contained in:
Rex Dieter 2016-01-27 12:37:47 -06:00
parent 81c710d651
commit ffc94b9780
2 changed files with 48 additions and 1 deletions

View File

@ -17,13 +17,17 @@
Summary: Qt5 - QtDeclarative component
Name: qt5-%{qt_module}
Version: 5.5.1
Release: 3%{?dist}
Release: 4%{?dist}
# See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details
License: LGPLv2 with exceptions or GPLv3 with exceptions
Url: http://www.qt.io
Source0: http://download.qt.io/official_releases/qt/5.5/%{version}%{?prerelease:-%{prerelease}}/submodules/%{qt_module}-opensource-src-%{version}%{?prerelease:-%{prerelease}}.tar.xz
## upstream
# memory leak/regression, http://bugreports.qt.io/browse/QTBUG-48799
Patch100: qtdeclarative-QTBUG-48799.patch
# support no_sse2 CONFIG (fedora i686 builds cannot assume -march=pentium4 -msse2 -mfpmath=sse flags, or the JIT that needs them)
# https://codereview.qt-project.org/#change,73710
Patch1: qtdeclarative-opensource-src-5.5.0-no_sse2.patch
@ -80,6 +84,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%prep
%setup -q -n %{qt_module}-opensource-src-%{version}%{?prerelease:-%{prerelease}}
%patch100 -p1 -b .QTBUG-48799
%patch1 -p1 -b .no_sse2
%patch2 -p1 -b .QQuickShaderEffectSource_deadlock
@ -208,6 +213,9 @@ popd
%changelog
* Wed Jan 27 2016 Rex Dieter <rdieter@fedoraproject.org> 5.5.1-4
- Memory leak in QSGBatchRenderer::Renderer::map() (QTBUG-48799)
* Sat Oct 24 2015 Rex Dieter <rdieter@fedoraproject.org> 5.5.1-3
- workaround QQuickShaderEffectSource::updatePaintNode deadlock (#1237269, kde#348385)

View File

@ -0,0 +1,39 @@
commit 3e9f61f305dc4c988e6f2718df56df80f639734e
Author: Martin Banky <Martin.Banky@gmail.com>
Date: Thu Oct 15 23:07:32 2015 -0700
Scene Graph: Fixed memory leak in QSGBatchRenderer::Renderer::map()
In the uncommon case (m_context->hasBrokenIndexBufferObjects()
|| m_visualizeMode != VisualizeNothing) of mapping a buffer, malloc is
called without first freeing the previous malloc.
Regression was introduced with:
qt5 commit: 9347499e78f03710eaf24af3c1e7ac650d0ef81d
qtdeclarative commit: a371bac3fba73f92aaa63a68d8ab1ae81a1d1031
[ChangeLog][QtQuick][Scene Graph] Fixed memory leak in
QSGBatchRenderer::Renderer::map()
Task-number: QTBUG-48799
Change-Id: I5ef4b7301d390463845aeb192851f86655962499
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 42b9f52..4b0bc68 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -895,11 +895,11 @@ void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf)
if (byteSize > pool.size())
pool.resize(byteSize);
buffer->data = pool.data();
- } else {
+ } else if (buffer->size != byteSize) {
+ free(buffer->data);
buffer->data = (char *) malloc(byteSize);
}
buffer->size = byteSize;
-
}
void Renderer::unmap(Buffer *buffer, bool isIndexBuf)