libcamera/include
Tomi Valkeinen ab2a10f007 libcamera: base: log: Fix LogCategory creation issues
Each declaration of a LogCategory will create a new LogCategory, and
will be stored in an unordered_set Logger::categories_. This means that
when a plugin .so is unloaded and loaded, as happens when destructing
and creating a CamereManager, we'll get duplicate categories.

The Logger::registerCategory docs say "Log categories must have unique
names. If a category with the same name already exists this function
performs no operation.". The code does not comply with this.

We solve the issue with two changes:

Change the unordered_set to a vector for simplicity, as there's no need
for an unordered_set.

Instead of using the LogCategory constructor to create new categories in
_LOG_CATEGORY() macro, use a factory method. The factory method will
return either an existing LogCategory if one exists with the given name,
or a newly created one.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-20 02:42:07 +03:00
..
android android: Add missing SPDX headers to Android headers 2022-09-30 21:51:18 +03:00
libcamera libcamera: base: log: Fix LogCategory creation issues 2022-10-20 02:42:07 +03:00
linux include: linux: Add V4L2 subdev internal routing API 2022-08-03 17:00:46 +03:00
meson.build libcamera: Fix base and ipa include dir 2021-09-28 20:09:39 +03:00