Fix null dereference in widget viewer dali
authortaeyoon <taeyoon0.lee@samsung.com>
Fri, 11 Nov 2016 02:52:51 +0000 (11:52 +0900)
committerTaeyoon Lee <taeyoon0.lee@samsung.com>
Fri, 11 Nov 2016 04:55:27 +0000 (20:55 -0800)
Change-Id: I5d1e60016b6b16f67b71f71b0d96156dc40a6c02

internal/widget_view/widget_view_impl.cpp

index 7c2f44b..d3d5295 100644 (file)
@@ -126,20 +126,22 @@ static void OnSurfaceUpdate( struct tizen_remote_surface* surface, wl_buffer* bu
 {
   Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
 
-  if( widgetView && !widgetView->IsWidgetImageView() )
+  if( widgetView )
   {
-    tizen_remote_surface_transfer_visibility( surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
+    if( !widgetView->IsWidgetImageView() )
+    {
+      tizen_remote_surface_transfer_visibility( surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
 
-    widgetView->CreateWidgetImageView();
-    widgetView->ConnectSignal( surface );
-    ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, OnKeyDown, surface );
-    ecore_event_handler_add( ECORE_EVENT_KEY_UP, OnKeyUp, surface );
+      widgetView->CreateWidgetImageView();
+      widgetView->ConnectSignal( surface );
+      ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, OnKeyDown, surface );
+      ecore_event_handler_add( ECORE_EVENT_KEY_UP, OnKeyUp, surface );
+    }
 
+    //get tbm surface from buffer
+    tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
+    widgetView->UpdateImageSource( tbmSurface );
   }
-
-  //get tbm surface from buffer
-  tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
-  widgetView->UpdateImageSource( tbmSurface );
 }
 
 static void OnSurfaceMissing( struct tizen_remote_surface* surface, void* data )