From: Hwankyu Jhun Date: Tue, 3 Mar 2020 22:58:38 +0000 (+0900) Subject: Fix Launcher Service X-Git-Tag: submit/tizen_5.5/20200304.234448~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16df753600c8b79dbf9165c01e43bf4ad138b488;p=platform%2Fcore%2Fappfw%2Fscreen-connector.git Fix Launcher Service - Uses RawImage ptr instead of shared_ptr ptr - Sets previous raw image handle after calling prepare_cb function Change-Id: I9fe2338354cd258e6e54a56b1c1d857edd6dd509 Signed-off-by: Hwankyu Jhun --- diff --git a/screen_connector_launcher_service/stub.cc b/screen_connector_launcher_service/stub.cc index 437bf24..c95d496 100644 --- a/screen_connector_launcher_service/stub.cc +++ b/screen_connector_launcher_service/stub.cc @@ -69,10 +69,11 @@ class LauncherServiceStub void OnPrepareEvent(std::shared_ptr image, uint32_t serial) override { - raw_image_ = std::move(image); if (ops_.prepare) { - ops_.prepare(reinterpret_cast(&raw_image_), serial, user_data_); + ops_.prepare(reinterpret_cast(image.get()), serial, + user_data_); } + raw_image_ = std::move(image); } void OnStopEvent(uint32_t serial) override { @@ -229,14 +230,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_direction( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *direction = __convert_direction(img->GetDirection()); return 0; @@ -250,14 +244,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_type( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *image_type = __convert_image_type(img->GetImageType()); return 0; @@ -271,14 +258,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_position_x( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *x = img->GetPositionX(); return 0; @@ -292,14 +272,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_position_y( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *y = img->GetPositionY(); return 0; @@ -314,14 +287,7 @@ screen_connector_launcher_service_image_get_shared_widget_info( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *shared_widget_info = strdup(img->GetSharedWidgetInfo().c_str()); if (*shared_widget_info == nullptr) { _E("Out of memory"); @@ -340,14 +306,7 @@ screen_connector_launcher_service_image_get_tbm_surface( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *tbm_surface = img->GetWlBuffer()->GetTbmSurface(); return 0; @@ -362,14 +321,7 @@ screen_connector_launcher_service_image_get_tbm_surface_info( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *tbm_surface_info = img->GetWlBuffer()->GetTbmSurfaceInfo(); return 0; @@ -383,14 +335,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_image_file( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *fd = img->GetImageFile()->GetRaw(); *size = img->GetImageFile()->GetSize(); @@ -405,14 +350,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_file_path( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *file_path = strdup(img->GetFilePath().c_str()); if (*file_path == nullptr) { _E("Out of memory"); @@ -430,14 +368,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_file_group( return -EINVAL; } - auto img_ptr = - reinterpret_cast*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast(handle); *file_group = strdup(img->GetFileGroup().c_str()); if (*file_group == nullptr) { _E("Out of memory");