[libcamera-devel] [PATCH] libcamera: object: Fix deleteLater() sample code

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Aug 24 00:46:49 CEST 2020


Hi Umang,

Thank you for the patch.

On Fri, Aug 21, 2020 at 06:40:28AM +0000, Umang Jain wrote:
> Instead of using "delete obj" in the custom deleter of the shared
> object, we should have been using the "obj->deleteLater()" to explain
> how the deleteLater() API should be used in practice.
> 
> Fixes: 9558886f7a85 ("libcamera: object: Add deleteLater() support)
> Signed-off-by: Umang Jain <email at uajain.com>

Oops, indeed.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Will push shortly.

> ---
>  src/libcamera/object.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp
> index 647ccda..cd83c68 100644
> --- a/src/libcamera/object.cpp
> +++ b/src/libcamera/object.cpp
> @@ -125,7 +125,7 @@ Object::~Object()
>   *     struct Deleter : std::default_delete<MyObject> {
>   *             void operator()(MyObject *obj)
>   *             {
> - *                     delete obj;
> + *                     obj->deleteLater();
>   *             }
>   *     };
>   *

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list