[waffle] [PATCH 4/8] android: cleanup surfaceflinger_link management

Emil Velikov emil.l.velikov at gmail.com
Tue Apr 5 22:52:21 UTC 2016


If the C++ runtime fails to create the relevant object(s) an exception
will be raised, thus the NULL checks will never get hit.

While we're here replace the opencoded SurfaceComposerClient dtor with
the proper one.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/waffle/android/droid_surfaceflingerlink.cpp | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/waffle/android/droid_surfaceflingerlink.cpp b/src/waffle/android/droid_surfaceflingerlink.cpp
index 9930e47..e8c31ab 100644
--- a/src/waffle/android/droid_surfaceflingerlink.cpp
+++ b/src/waffle/android/droid_surfaceflingerlink.cpp
@@ -63,14 +63,7 @@ static void
 droid_tear_down_surfaceflinger_link(
                 waffle::droid_surfaceflinger_container* pSFContainer)
 {
-    if( pSFContainer == NULL)
-        return;
-
-    if (pSFContainer->composer_client != NULL) {
-        pSFContainer->composer_client->dispose();
-        pSFContainer->composer_client = NULL;
-    }
-
+    delete pSFContainer->composer_client;
     delete pSFContainer;
 }
 
@@ -82,10 +75,6 @@ droid_setup_surfaceflinger_link()
     droid_surfaceflinger_container* pSFContainer;
 
     pSFContainer = new droid_surfaceflinger_container;
-
-    if (pSFContainer == NULL)
-        goto error;
-
     pSFContainer->composer_client = new SurfaceComposerClient;
     iRVal = pSFContainer->composer_client->initCheck();
     if (iRVal != NO_ERROR) {
-- 
2.8.0



More information about the waffle mailing list