Fixed a potential memory corruption due to update and render potentially using the... 53/46753/3
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 25 Aug 2015 14:31:46 +0000 (15:31 +0100)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 25 Aug 2015 15:51:55 +0000 (16:51 +0100)
commit493232fa8cabba0e7fd645dd5c6c19456e93461d
treebe63b121ea2d59c2230f37cc55806b3c5a17483e
parent6a51109b0296438dad867e814e14d7bf8b630201
Fixed a potential memory corruption due to update and render potentially using the same container simultaneously

Fixed by not using double buffering with index but having two separate containers

==5511== ----------------------------------------------------------------
==5511== Possible data race during read of size 4 at 0x14ECD29C by thread #4
==5511== Locks held: none
==5511==    at 0x55ADFB1: Dali::Internal::SceneGraph::UpdateManager::SaveBinary(Dali::IntrusivePtr<Dali::Internal::ShaderData>) (update-manager.cpp:632)
==5511==    by 0x5599DF4: Dali::Internal::ProgramController::StoreBinary(Dali::IntrusivePtr<Dali::Internal::ShaderData>) (program-controller.cpp:151)
==5511==    by 0x5598CFD: Dali::Internal::Program::Load() (program.cpp:559)
==5511==    by 0x5598DB4: Dali::Internal::Program::Use() (program.cpp:135)
==5511==    by 0x559799C: Dali::Internal::SceneGraph::Renderer::Render(Dali::Internal::Context&, Dali::Internal::SceneGraph::TextureCache&, unsigned int, Dali::Internal::SceneGraph::Shader&, Dali::Matrix const&, Dali::Matrix const&, Dali::Matrix const&, float, bool) (scene-graph-renderer.cpp:213)
==5511==    by 0x55891B2: Dali::Internal::Render::ProcessRenderInstruction(Dali::Internal::SceneGraph::RenderInstruction const&, Dali::Internal::Context&, Dali::Internal::SceneGraph::TextureCache&, Dali::Internal::SceneGraph::Shader&, unsigned int, float) (render-algorithms.cpp:146)
==5511==    by 0x558BDE5: Dali::Internal::SceneGraph::RenderManager::DoRender(Dali::Internal::SceneGraph::RenderInstruction&, Dali::Internal::SceneGraph::Shader&, float) (render-manager.cpp:558)
==5511==    by 0x558C423: Dali::Internal::SceneGraph::RenderManager::Render(Dali::Integration::RenderStatus&) (render-manager.cpp:430)
==5511==    by 0x551D25C: Dali::Internal::Core::Render(Dali::Integration::RenderStatus&) (core-impl.cpp:278)
==5511==    by 0x4E72B04: Dali::Internal::Adaptor::RenderThread::Run() (render-thread.cpp:199)
==5511==    by 0x4E72B58: Dali::Internal::Adaptor::RenderThread::InternalThreadEntryFunc(void*) (render-thread.h:197)
==5511==    by 0x4C30E26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==5511==
==5511== This conflicts with a previous write of size 4 by thread #3
==5511== Locks held: none
==5511==    at 0x559F1EF: Dali::Internal::SceneGraph::SceneGraphBuffers::Swap() (scene-graph-buffers.cpp:45)
==5511==    by 0x55ADADA: Dali::Internal::SceneGraph::UpdateManager::Update(float, unsigned int, unsigned int) (update-manager.cpp:1121)
==5511==    by 0x551D229: Dali::Internal::Core::Update(float, unsigned int, unsigned int, Dali::Integration::UpdateStatus&) (core-impl.cpp:261)
==5511==    by 0x4E74438: Dali::Internal::Adaptor::UpdateThread::Run() (update-thread.cpp:119)
==5511==    by 0x4E744A8: Dali::Internal::Adaptor::UpdateThread::InternalThreadEntryFunc(void*) (update-thread.h:107)
==5511==    by 0x4C30E26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==5511==    by 0x908A181: start_thread (pthread_create.c:312)
==5511==    by 0x5E8EFBC: clone (clone.S:111)
==5511==
==5511== Address 0x14ECD29C is 12 bytes inside a block of size 24 alloc'd
==5511==    at 0x4C2C460: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==5511==    by 0x551D745: Dali::Internal::Core::Core(Dali::Integration::RenderController&, Dali::Integration::PlatformAbstraction&, Dali::Integration::GlAbstraction&, Dali::Integration::GlSyncAbstraction&, Dali::Integration::GestureManager&, Dali::ResourcePolicy::DataRetention) (core-impl.cpp:149)
==5511==    by 0x55BB824: Dali::Integration::Core::New(Dali::Integration::RenderController&, Dali::Integration::PlatformAbstraction&, Dali::Integration::GlAbstraction&, Dali::Integration::GlSyncAbstraction&, Dali::Integration::GestureManager&, Dali::ResourcePolicy::DataRetention) (core.cpp:37)
==5511==    by 0x4E9E9E8: Dali::Internal::Adaptor::Adaptor::Initialize(Dali::Configuration::ContextLoss) (adaptor-impl.cpp:139)
==5511==    by 0x4E9FC3C: Dali::Internal::Adaptor::Adaptor::New(Dali::Any, Dali::RenderSurface*, Dali::Configuration::ContextLoss, Dali::Internal::Adaptor::EnvironmentOptions*) (adaptor-impl.cpp:79)
==5511==    by 0x4E9FD05: Dali::Internal::Adaptor::Adaptor::New(Dali::Window, Dali::Configuration::ContextLoss, Dali::Internal::Adaptor::EnvironmentOptions*) (adaptor-impl.cpp:89)
==5511==    by 0x4EA22BB: Dali::Internal::Adaptor::Application::CreateAdaptor() (application-impl.cpp:134)
==5511==    by 0x4EA2407: Dali::Internal::Adaptor::Application::OnInit() (application-impl.cpp:175)
==5511==    by 0x4EB8B88: Dali::Internal::Adaptor::Framework::AppStatusHandler(int, void*) (framework-tizen.cpp:380)
==5511==    by 0x7D6BC9D: app_appcore_create (app_main.c:149)
==5511==    by 0x7F6E819: appcore_efl_main (appcore-efl.c:16)
==5511==    by 0x7D6BDEC: app_efl_main (app_main.c:116)
==5511== ----------------------------------------------------------------

Change-Id: I1bdcfd8c00d9f37b0dd1f3f580f1bd69d4e0a20b
dali/internal/update/manager/update-manager.cpp