{"id":9084,"url":"https://patchwork.libcamera.org/api/1.1/covers/9084/?format=json","web_url":"https://patchwork.libcamera.org/cover/9084/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200731105335.62014-1-email@uajain.com>","date":"2020-07-31T10:53:41","name":"[libcamera-devel,v2,0/3] Add Object::deleteLater() support","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"mbox":"https://patchwork.libcamera.org/cover/9084/mbox/","series":[{"id":1167,"url":"https://patchwork.libcamera.org/api/1.1/series/1167/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1167","date":"2020-07-31T10:53:41","name":"Add Object::deleteLater() support","version":2,"mbox":"https://patchwork.libcamera.org/series/1167/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/9084/comments/","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9C8E5BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Jul 2020 10:53:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D1F261E8B;\n\tFri, 31 Jul 2020 12:53:45 +0200 (CEST)","from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C4CBC611A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Jul 2020 12:53:42 +0200 (CEST)","by filterdrecv-p3iad2-d8cc6d457-mbgrc with SMTP id\n\tfilterdrecv-p3iad2-d8cc6d457-mbgrc-20-5F23F835-4\n\t2020-07-31 10:53:41.195088329 +0000 UTC m=+146721.277578589","from mail.uajain.com (unknown)\n\tby ismtpd0003p1hnd1.sendgrid.net (SG) with ESMTP id\n\t-LphvwJxQxazceky3YCWIQ for <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Jul 2020 10:53:40.673 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"VW8AWFIn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:mime-version:to:cc:content-transfer-encoding:\n\tcontent-type;\n\ts=s1; bh=I04tn81IngKwKAJKQ7dYDsm1euX/qYOFXXBHEHb+CcI=;\n\tb=VW8AWFInDitgLpIan/KgxReMDWACkzSTMbdTskbmTZL4FlnmzlaI6zXTUyY6GU+zNRwM\n\tHYQTB2yDlVcJLld/N2KmLB8IC5X9HfngLYgiJV4rXPzNri3LMrVIyqvBfxSCsTXcSO3l13\n\ttjQhJt9CPPE2jBVBFE8JuQG9mWkhugqBM=","From":"Umang Jain <email@uajain.com>","Date":"Fri, 31 Jul 2020 10:53:41 +0000 (UTC)","Message-Id":"<20200731105335.62014-1-email@uajain.com>","Mime-Version":"1.0","X-SG-EID":"1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcIQ89AvAiYjJmgYkN1WcnPZEWb2pj5GIxoFLTGE/1KO5rE2Dy1FN/xfvB5ms8kZmlRVE+ef6IZxR9+pXHyi9/it1Mo/wO6BqvTQiu53jgzP8nKd3O3+sNdnVWjXC+uZ9qO5b/zwwkCjr1eUp82LrNHdu9iBL7uCdhUK91l8BJhI12gFAVeS4hsuj0JdtnE2QmogGRHQ4w4Q55HyQGBL+LvQ==","To":"libcamera-devel@lists.libcamera.org","Subject":"[libcamera-devel] [PATCH v2 0/3] Add Object::deleteLater() support","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Implementation of Object::deleteLater() which ensures shared objects\nare deleted in the thread to which they belong. This fixes the issue\nwhere on hot-unplug, the Camera object is deleted in QCam's application\nthread instead of CameraManager's thread and triggering the ASSERT()\nin processNotifier (since the event notifier got deleted out of \ncontext in a different thread). See [1] for discussion.\n\n[1] https://lists.libcamera.org/pipermail/libcamera-devel/2020-July/010951.html\n\nChanges in v2:\n  - Extend Thread::setEventDispatcher to selectively deliver messages\n    - This will help if we want to explicitly deliver some messages if\n      event loop is not running.\n  - Include Object::deleteLater() unit test\n    - One \\todo here as one case pending to cover; multiple\n      deleteLater() should only delete the object once.\n  - Review comments (mostly documentation fixes).\n\nUmang Jain (3):\n  libcamera: thread: Support selective message dispatch to thread\n  libcamera: object: Add deleteLater() support\n  libcamera: camera: Ensure deletion via deleteLater()\n\n include/libcamera/camera.h              |   3 +-\n include/libcamera/internal/message.h    |   2 +\n include/libcamera/internal/thread.h     |   3 +-\n include/libcamera/object.h              |   2 +\n src/libcamera/camera.cpp                |   2 +-\n src/libcamera/camera_manager.cpp        |   6 +-\n src/libcamera/event_dispatcher_poll.cpp |   2 +-\n src/libcamera/message.cpp               |   4 +\n src/libcamera/object.cpp                |  48 +++++++++\n src/libcamera/thread.cpp                |  47 ++++++---\n test/meson.build                        |   1 +\n test/object-delete.cpp                  | 125 ++++++++++++++++++++++++\n 12 files changed, 227 insertions(+), 18 deletions(-)\n create mode 100644 test/object-delete.cpp"}