Initialized SG::Scene::mGraphicsController in constructor 33/270033/2
authorDavid Steele <david.steele@samsung.com>
Mon, 24 Jan 2022 12:05:04 +0000 (12:05 +0000)
committerDavid Steele <david.steele@samsung.com>
Mon, 24 Jan 2022 12:14:00 +0000 (12:14 +0000)
Change-Id: I813f9643c1e4e92a6e2f01a342a2c6981b479f7a

dali/internal/update/common/scene-graph-scene.cpp
dali/internal/update/common/scene-graph-scene.h

index 9360c32..2aa0287 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ void Scene::Initialize(Graphics::Controller& graphicsController, Integration::De
   mGraphicsController = &graphicsController;
 
   // Create the render target for the surface. It should already have been sent via message.
-  mRenderTarget = mGraphicsController->CreateRenderTarget(mRenderTargetCreateInfo, std::move(mRenderTarget));
+  mRenderTarget = graphicsController.CreateRenderTarget(mRenderTargetCreateInfo, std::move(mRenderTarget));
 
   // Create the render pass for the surface
   std::vector<Graphics::AttachmentDescription> attachmentDescriptions;
@@ -199,7 +199,10 @@ void Scene::SetSurfaceRenderTargetCreateInfo(const Graphics::RenderTargetCreateI
   {
     // Only recreate if the surface has changed.
     mRenderTargetCreateInfo = renderTargetCreateInfo;
-    mRenderTarget           = mGraphicsController->CreateRenderTarget(renderTargetCreateInfo, std::move(mRenderTarget));
+    if(mGraphicsController) // shouldn't be null, as we can't have already set mRenderTarget unless graphics controller exists.
+    {
+      mRenderTarget = mGraphicsController->CreateRenderTarget(renderTargetCreateInfo, std::move(mRenderTarget));
+    }
   }
   else
   {
index d8c8643..3183795 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_SCENE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -268,7 +268,7 @@ private:
 
   RenderInstructionContainer mInstructions; ///< Render instructions for the scene
 
-  Graphics::Controller* mGraphicsController; ///< Graphics controller
+  Graphics::Controller* mGraphicsController{nullptr}; ///< Graphics controller
 
   Dali::Integration::Scene::FrameCallbackContainer mFrameRenderedCallbacks;  ///< Frame rendered callbacks
   Dali::Integration::Scene::FrameCallbackContainer mFramePresentedCallbacks; ///< Frame presented callbacks