mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
cam: options: Store options in a list instead of a vector
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
69be770715
commit
6f3503981a
1 changed files with 2 additions and 2 deletions
|
@ -8,8 +8,8 @@
|
||||||
#define __CAM_OPTIONS_H__
|
#define __CAM_OPTIONS_H__
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
enum OptionArgument {
|
enum OptionArgument {
|
||||||
ArgumentNone,
|
ArgumentNone,
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
void usage();
|
void usage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Option> options_;
|
std::list<Option> options_;
|
||||||
std::map<unsigned int, Option *> optionsMap_;
|
std::map<unsigned int, Option *> optionsMap_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue