summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-02 01:30:41 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-11 17:42:02 +0300
commitda9b6bb196e0165342a414657edfc5aaf165baa5 (patch)
tree82dddf1faf7e571f1a7781a96f70b0d92b60115b /src/ipa/raspberrypi/controller/sharpen_algorithm.hpp
parent1f7f7a72ed47a4a9cbfcda9dc26f490d5ef7b1af (diff)
base: thread: Fix recursive calls to dispatchMessages()
There are use cases for calling the dispatchMessages() function recursively, from within a message handler. This can be used, for instance, to force delivery of messages posted to a thread concurrently to stopping the thread. This currently causes access, in the outer dispatchMessages() call, to iterators that have been invalidated by erasing list elements in the recursive call, leading to undefined behaviour (most likely double-free or other crashes). Fix it by only erasing messages from the list at the end of the outer call, identified using a recursion counter. Bug: https://bugs.libcamera.org/show_bug.cgi?id=26 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller/sharpen_algorithm.hpp')
0 files changed, 0 insertions, 0 deletions
/* SPDX-License-Identifier: GPL-2.0-or-later *//* * Copyright (C) 2019, Google Inc. * * control_info.cpp - ControlInfo tests */#include <iostream>#include <libcamera/control_ids.h>#include <libcamera/controls.h>#include"test.h"using namespace std;using namespace libcamera;class ControlInfoTest :public Test {protected:intrun(){/* * Test information retrieval from a range with no minimum and * maximum. */ ControlInfo brightness;if(brightness.min().get<int32_t>() !=0|| brightness.max().get<int32_t>() !=0) { cout <<"Invalid control range for Brightness"<< endl;return TestFail;}/* * Test information retrieval from a control with a minimum and * a maximum value. */ ControlInfo contrast(10,200);if(contrast.min().get<int32_t>() !=10|| contrast.max().get<int32_t>() !=200) { cout <<"Invalid control range for Contrast"<< endl;return TestFail;}/* * Test information retrieval from a control with boolean * values. */ ControlInfo aeEnable({false,true},false);if(aeEnable.min().get<bool>() !=false|| aeEnable.def().get<bool>() !=false|| aeEnable.max().get<bool>() !=true) { cout <<"Invalid control range for AeEnable"<< endl;return TestFail;}if(aeEnable.values()[0].get<bool>() !=false|| aeEnable.values()[1].get<bool>() !=true) { cout <<"Invalid control values for AeEnable"<< endl;return TestFail;} ControlInfo awbEnable(true);if(awbEnable.min().get<bool>() !=true|| awbEnable.def().get<bool>() !=true|| awbEnable.max().get<bool>() !=true) { cout <<"Invalid control range for AwbEnable"<< endl;return TestFail;}if(awbEnable.values()[0].get<bool>() !=true) { cout <<"Invalid control values for AwbEnable"<< endl;return TestFail;}return TestPass;}};TEST_REGISTER(ControlInfoTest)