From patchwork Sat Apr 15 21:03:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 18535 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 7E788BE173 for ; Sat, 15 Apr 2023 21:03:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BB84C627B8; Sat, 15 Apr 2023 23:03:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1681592633; bh=yreNef4YxR2dxJGWClW019xCueNnCI5G7J9OlIALz0s=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=xkzSCaXT55RFebparj2NiS5qG0xbIIUPIS9+S98zSCIgBQLXt38xt57RaowQXhLS1 e1nrolcs0YebGs+IhV+d7MVtOkMBh83F5pAWg6S82D32qo+/XJ203aFJJ7Kt+nJG+H veMQv35/Mvlevh/IOZj36KXUre+Nw3un7bV86AR++MLG1s1/apGJt1u4sx+JyUmaV9 SNlKQsrLwTItCfjK6bU7OABaI0X7z01t+hjXqThfKfDDadsHHCbxgIhvAuwio2G+hn Asg9fV9sujL52rvYup8qltMwnH+rCutvejxtI98HSO5ra+l5t0DmAb0udtvPQK13ml cD9b5DasAOCMg== Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C33D4627B2 for ; Sat, 15 Apr 2023 23:03:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="MDb/ihS/"; dkim-atps=neutral Date: Sat, 15 Apr 2023 21:03:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1681592631; x=1681851831; bh=yreNef4YxR2dxJGWClW019xCueNnCI5G7J9OlIALz0s=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=MDb/ihS/3ot1X8dDSbn31cSS1U+pw6MMGZ0EGuP++b4xh5oD0IL06235gmI4gh3/V 9SgOsfHEHSE+pqpDsZLP1Cr8LFfUxEAZ9lU0fq3fq690blz2X89mXAFynC5BY4MlVC I79fvj3hPruGJ1oyphRnPM7ds8tD8b4iOQl/+llA22IhQKc8EEVAe6BxUERTljhQFi QjeZEaaVdxa9T5A2bbDv0o2iwD5fl4wOdE3z6eqDPT+5rccXpqpl/9/dcZNyO4A/5Y m+Fg7XVW5sKPCgg7701cUUqxrOC9GQDy8XrSt5YhcjGrL6bWvfHr7ekbckoSKZDkMl COOIYKhHXRMfQ== To: libcamera-devel@lists.libcamera.org Message-ID: <20230415205742.268255-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v1] libcamera: device_enumerator_udev: remove devnum from dependency map 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: , X-Patchwork-Original-From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze_via_libcamera-devel?= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Reply-To: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Previously, after `addV4L2Device()` had seen all dependecies, it would remove the `MediaDeviceDeps` object from the `pending_` list, which would result in it being destroyed. However, there would still be (dangling) pointers to this object in `devMap_` that were added in `addUdevDevice()` (line 103). So remove the entry with the given devnum when it is removed from the corresponding `MediaDeviceDeps` object. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/device_enumerator_udev.cpp | 1 + 1 file changed, 1 insertion(+) -- 2.40.0 diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp index 5317afbd..a63cd360 100644 --- a/src/libcamera/device_enumerator_udev.cpp +++ b/src/libcamera/device_enumerator_udev.cpp @@ -315,6 +315,7 @@ int DeviceEnumeratorUdev::addV4L2Device(dev_t devnum) * enumerator. */ deps->deps_.erase(devnum); + devMap_.erase(it); if (deps->deps_.empty()) { LOG(DeviceEnumerator, Debug)