[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - avmedia/source external/libgltf

Zolnai Tamás tamas.zolnai at collabora.com
Tue May 27 01:52:53 PDT 2014


 avmedia/source/opengl/oglplayer.cxx              |   10 +++
 external/libgltf/UnpackedTarball_libgltf.mk      |    1 
 external/libgltf/patches/free_file_buffers.patch |   58 -----------------------
 3 files changed, 10 insertions(+), 59 deletions(-)

New commits:
commit f8436baa2267695455973a6fa42916f9ffc5c9da
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Tue May 27 10:48:43 2014 +0200

    libgltf: solve this memory leak problem on a better way
    
    Change-Id: I6e6fbf47c216bf9151e92d5e2a5b4eee57f52989

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 2536b68..7831f6b 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -195,6 +195,14 @@ awt::Size SAL_CALL OGLPlayer::getPreferredPlayerWindowSize() throw ( uno::Runtim
     return awt::Size( 480, 360 );
 }
 
+static void lcl_ReleaseFiles(glTFHandle* pHandle)
+{
+    for( int i = 0; i < pHandle->size; ++i )
+    {
+        delete [] pHandle->files[i].buffer;
+    }
+}
+
 uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments )
      throw ( uno::RuntimeException, std::exception )
 {
@@ -219,6 +227,7 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
     m_pHandle->viewport.width = aSize.Width();
     m_pHandle->viewport.height = aSize.Height();
     gltf_renderer_set_content(m_pHandle);
+    lcl_ReleaseFiles(m_pHandle);
     m_pOGLWindow = new OGLWindow(m_pHandle, &m_aContext, pChildWindow);
     return uno::Reference< media::XPlayerWindow >( m_pOGLWindow );
 }
@@ -239,6 +248,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
     m_pHandle->viewport.width = getPreferredPlayerWindowSize().Width;
     m_pHandle->viewport.height = getPreferredPlayerWindowSize().Height;
     gltf_renderer_set_content(m_pHandle);
+    lcl_ReleaseFiles(m_pHandle);
     return uno::Reference< media::XFrameGrabber >();
     OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_pHandle );
     return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index acfbab0..d8434b6 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -18,7 +18,6 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libgltf,1))
 $(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
 	external/libgltf/patches/include_path_glew.patch \
 	external/libgltf/patches/include_path_freetype.patch \
-	external/libgltf/patches/free_file_buffers.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/free_file_buffers.patch b/external/libgltf/patches/free_file_buffers.patch
deleted file mode 100644
index 9f92da3..0000000
--- a/external/libgltf/patches/free_file_buffers.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp
---- libgltf.org/src/LoadScene.cpp	2014-05-26 21:46:51.986986538 +0200
-+++ libgltf/src/LoadScene.cpp	2014-05-26 21:47:28.206985004 +0200
-@@ -127,7 +127,7 @@
-     return gHandle;
- }
- 
--bool Parser::releaseFileName()
-+bool Parser::releaseFiles()
- {
-     glTFHandle* gHandle = pScene->getGltfHandle();
-     for (int i = (int)gHandle->size - 1 ; i >= 0 ; i--)
-@@ -137,6 +137,7 @@
-             free(gHandle->files[i].filename);
-             gHandle->files[i].filename = NULL;
-         }
-+        delete [] gHandle->files[i].buffer;
-     }
- 
-     if (gHandle->files != NULL)
-diff -ur libgltf.org/src/LoadScene.h libgltf/src/LoadScene.h
---- libgltf.org/src/LoadScene.h	2014-05-26 21:46:51.986986538 +0200
-+++ libgltf/src/LoadScene.h	2014-05-26 21:47:33.170984793 +0200
-@@ -26,7 +26,7 @@
- {
- public:
-     glTFHandle* getFileNameInJson(const std::string& jsonFile);
--    bool releaseFileName();
-+    bool releaseFiles();
-     int parseScene(Scene* pscene);
-     bool parseJsonFile();
-     void setJsonInfo(const std::string& sbuffer);
-@@ -81,4 +81,4 @@
-     bool is_json_in_buffer;
- };
- 
--#endif
-\ No newline at end of file
-+#endif
-diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
---- libgltf.org/src/RenderScene.cpp	2014-05-26 21:46:51.986986538 +0200
-+++ libgltf/src/RenderScene.cpp	2014-05-26 21:47:39.358984531 +0200
-@@ -1426,7 +1426,7 @@
- 
- void RenderScene::releaseRender()
- {
--    mLoadJson.releaseFileName();
-+    mLoadJson.releaseFiles();
-     fbo.releaseFbo();
-     return;
- }
-@@ -1543,4 +1543,4 @@
- int  RenderScene::isAnimPlay()
- {
-     return this->mAnimationPlay ? 1 : 0;
--}
-\ No newline at end of file
-+}


More information about the Libreoffice-commits mailing list