Show a patch.

GET /api/1.1/patches/271/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 271,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/271/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/271/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20190118003201.3110-1-laurent.pinchart@ideasonboard.com>",
    "date": "2019-01-18T00:32:01",
    "name": "[libcamera-devel,v1.1,2/4] libcamera: camera_manager: Use std::unique_ptr to store event dispatcher",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "074debb17338150338d3ad60f1fcfb0640e781fb",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/271/mbox/",
    "series": [
        {
            "id": 91,
            "url": "https://patchwork.libcamera.org/api/1.1/series/91/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=91",
            "date": "2019-01-18T00:32:01",
            "name": null,
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/91/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/271/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/271/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E1F3D60B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jan 2019 01:32:06 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6935A53F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jan 2019 01:32:06 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1547771526;\n\tbh=qF1twtbU6EoasVW2D49K7A5kQ4gDeR25xbDF1JPuEdc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=CiQ9fO+PXGsozspkIrLwM/rcT8SRVvthn3hpBcjjp+0hLf76NtNL804goV2/VNZOB\n\tzhzpZSM1HtyR4pmSKWElcEw+gH3PA6819Lwe24BwnMnfKjlOh/sdG77XidpijYQWFK\n\t3HGEIOwwZGmb0pVWHvP0Tw8lzGyHl994PM+w7UH0=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 18 Jan 2019 02:32:01 +0200",
        "Message-Id": "<20190118003201.3110-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.2",
        "In-Reply-To": "<20190117235916.1906-3-laurent.pinchart@ideasonboard.com>",
        "References": "<20190117235916.1906-3-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1.1 2/4] libcamera: camera_manager: Use\n\tstd::unique_ptr to store event dispatcher",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Fri, 18 Jan 2019 00:32:07 -0000"
    },
    "content": "The CameraManager takes ownership of the dispatcher passed to the\nsetEventDispatcher() function. Enforces this by using std::unique_ptr<>.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Use make_unique<> in CameraManager::setEventDispatcher()\n---\n include/libcamera/camera_manager.h |  4 ++--\n src/libcamera/camera_manager.cpp   | 12 +++++++-----\n 2 files changed, 9 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h\nindex 6cfcba3c3933..b82a8ce95b9f 100644\n--- a/include/libcamera/camera_manager.h\n+++ b/include/libcamera/camera_manager.h\n@@ -29,7 +29,7 @@ public:\n \n \tstatic CameraManager *instance();\n \n-\tvoid setEventDispatcher(EventDispatcher *dispatcher);\n+\tvoid setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);\n \tEventDispatcher *eventDispatcher();\n \n private:\n@@ -41,7 +41,7 @@ private:\n \tstd::unique_ptr<DeviceEnumerator> enumerator_;\n \tstd::vector<PipelineHandler *> pipes_;\n \n-\tEventDispatcher *dispatcher_;\n+\tstd::unique_ptr<EventDispatcher> dispatcher_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\nindex 9f554be57e33..1430bb0d75a5 100644\n--- a/src/libcamera/camera_manager.cpp\n+++ b/src/libcamera/camera_manager.cpp\n@@ -12,6 +12,7 @@\n #include \"event_dispatcher_poll.h\"\n #include \"log.h\"\n #include \"pipeline_handler.h\"\n+#include \"utils.h\"\n \n /**\n  * \\file camera_manager.h\n@@ -58,7 +59,6 @@ CameraManager::CameraManager()\n \n CameraManager::~CameraManager()\n {\n-\tdelete dispatcher_;\n }\n \n /**\n@@ -209,14 +209,14 @@ CameraManager *CameraManager::instance()\n  * The CameraManager takes ownership of the event dispatcher and will delete it\n  * when the application terminates.\n  */\n-void CameraManager::setEventDispatcher(EventDispatcher *dispatcher)\n+void CameraManager::setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher)\n {\n \tif (dispatcher_) {\n \t\tLOG(Warning) << \"Event dispatcher is already set\";\n \t\treturn;\n \t}\n \n-\tdispatcher_ = dispatcher;\n+\tdispatcher_ = std::move(dispatcher);\n }\n \n /**\n@@ -226,14 +226,16 @@ void CameraManager::setEventDispatcher(EventDispatcher *dispatcher)\n  * If no dispatcher has been set, a default poll-based implementation is created\n  * and returned, and no custom event dispatcher may be installed anymore.\n  *\n+ * The returned event dispatcher is valid until the camera manager is destroyed.\n+ *\n  * \\return Pointer to the event dispatcher\n  */\n EventDispatcher *CameraManager::eventDispatcher()\n {\n \tif (!dispatcher_)\n-\t\tdispatcher_ = new EventDispatcherPoll();\n+\t\tdispatcher_ = utils::make_unique<EventDispatcherPoll>();\n \n-\treturn dispatcher_;\n+\treturn dispatcher_.get();\n }\n \n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v1.1",
        "2/4"
    ]
}