From patchwork Thu Jan 31 23:47:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 465 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F0D2060DBE for ; Fri, 1 Feb 2019 00:47:41 +0100 (CET) Received: from pendragon.ideasonboard.com (85-76-34-136-nat.elisa-mobile.fi [85.76.34.136]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9DE6441; Fri, 1 Feb 2019 00:47:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1548978461; bh=1SjAz47QewbqEpJqOPs+aEs9AXpL3qZv/nw0xVmU9ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzMzcyv4pBwlMJ+SYSEIOsLfaLqV1qK3vGXFq3TuSl+EuSZ9AY9lhZCuc3SAuscU5 TSJVgMmrT6feo9utmn2vc109kzts4Iiduhz4lT4AOQzIRG9oG3X+d5Epa5Yw5yKnh9 AMiULa1Jm1uslciErlBgSJSXjPTiBI3gQCQNZcWQ= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 1 Feb 2019 01:47:18 +0200 Message-Id: <20190131234721.22606-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190131234721.22606-1-laurent.pinchart@ideasonboard.com> References: <20190131234721.22606-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/8] cam: options: Store options in a list instead of a vector X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 23:47:42 -0000 When option are added to the parser, they are stored in the OptionsParser::options_ vector, and a pointer to the option referencing the vector entry is indexed in the OptionsParser::optionsMap_ map. When the next option is added the vector may be resized, which invalidates the pointers stored in the map. Fix this by storing the options in an std::list<> instead of std::vector<>. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cam/options.h b/src/cam/options.h index 2272385a0b83..b9b7bd258c03 100644 --- a/src/cam/options.h +++ b/src/cam/options.h @@ -8,8 +8,8 @@ #define __CAM_OPTIONS_H__ #include +#include #include -#include enum OptionArgument { ArgumentNone, @@ -57,7 +57,7 @@ public: void usage(); private: - std::vector