From patchwork Tue Mar 23 01:42:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11648 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7E58AC32E1 for ; Tue, 23 Mar 2021 01:42:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 32FBA68D71; Tue, 23 Mar 2021 02:42:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ej0jtTg5"; dkim-atps=neutral Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6F48168D71 for ; Tue, 23 Mar 2021 02:42:42 +0100 (CET) Received: by mail-pj1-x102b.google.com with SMTP id x7-20020a17090a2b07b02900c0ea793940so11495543pjc.2 for ; Mon, 22 Mar 2021 18:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v2/oim4Rfz4IZCVjag7lbWijILii27gCvbe9QBaHfhw=; b=Ej0jtTg5/wMOK6wNJ9Wcs+KAilwsIlo8I3cn2lh3GNVaqMxhSvLg+/c3k0RdaB5F6X pMZVYTzbl+iQ4TMCww/KsO1/iaFTq0zWg70LxAHP4plgwsen0t+KvbRRvg7QdJpRyerp mTu6cyjgSsX36yd2dzEM/TRsgn6J818iciLZU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v2/oim4Rfz4IZCVjag7lbWijILii27gCvbe9QBaHfhw=; b=rWCh1D0qmbMF1PnTUKG2/FkhMk/usIpYrhkCJG3XidZvRIpAC+CoFbUMRZHVuREcve +YOafMtOYpzJP21BTg3dHCcd+PSz68zVhrCd9cRwLAl9RuXLP5WvLlfEqZUNYMtq8tPs DXIEYDCIEijcAIo9NGuNNgN9yh2QSaGo/7DPH0EHGHLsiUoJU+ih47ww2louM1EMr7te f7xY7+FXJyX5dujeaF5szGAfmgM+2GezK6JF4EgKn4U9eBN1eqV1gCnpUC68OCK+aDN7 Igd7vtYc2XxnkqxFQLAklOJjGE8e2r0JKGBkMOFk0QRQR7KXLgsLCEFKpMXr2xx9C0Zf agfQ== X-Gm-Message-State: AOAM531bwTf2qgRwNHZ0llDpABNJQdz2Z9Whv7C/6YhX60MO79uWs/T9 HFrC62Biv8YDZshkrQUB1uEXEoa6Rwh/gw== X-Google-Smtp-Source: ABdhPJw+1UGvln5QxgVjzz88tMc6ZMxMT4quPI4XTQ26tZR98UImVJuyt5eeTo39XTwSovfyg466zQ== X-Received: by 2002:a17:90b:108f:: with SMTP id gj15mr1896055pjb.177.1616463760384; Mon, 22 Mar 2021 18:42:40 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:8115:e5cc:747b:64de]) by smtp.gmail.com with ESMTPSA id h13sm590527pjv.52.2021.03.22.18.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 18:42:40 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 23 Mar 2021 10:42:21 +0900 Message-Id: <20210323014226.3211412-4-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210323014226.3211412-1-hiroh@chromium.org> References: <20210323014226.3211412-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/8] android: CameraHalManager: Fix a function call of a moved Camera X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This fixes a bug of calling Camera::id() of a moved Camera. Signed-off-by: Hirokazu Honda --- src/android/camera_hal_manager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.31.0.rc2.261.g7f71774620-goog diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index fa398fea..df3f1cd2 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -95,7 +95,8 @@ void CameraHalManager::cameraAdded(std::shared_ptr cam) * IDs starts from '0' for internal cameras and '1000' for external * cameras. */ - auto iter = cameraIdsMap_.find(cam->id()); + std::string cameraId = cam->id(); + auto iter = cameraIdsMap_.find(cameraId); if (iter != cameraIdsMap_.end()) { id = iter->second; } else { @@ -117,12 +118,12 @@ void CameraHalManager::cameraAdded(std::shared_ptr cam) std::unique_ptr camera = CameraDevice::create(id, std::move(cam)); int ret = camera->initialize(); if (ret) { - LOG(HAL, Error) << "Failed to initialize camera: " << cam->id(); + LOG(HAL, Error) << "Failed to initialize camera: " << cameraId; return; } if (isCameraNew) { - cameraIdsMap_.emplace(cam->id(), id); + cameraIdsMap_.emplace(cameraId, id); if (isCameraExternal) nextExternalCameraId_++;