mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
libcamera: fix a segfault caused by queueing no longer valid requests
The requests_ vector contains the requests created for a camera on start() but the vector elements are not removed on camera stop(). This leads to a segfault, when these requests that are no longer valid are queued again. Also move the streamName_ map clear to LibCamera::stop() where it should be, since its elements are added in the LibCamera::start() function.
This commit is contained in:
parent
439dc8eb2a
commit
310e6009ca
1 changed files with 2 additions and 1 deletions
|
|
@ -486,7 +486,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
int LibCamera::start() {
|
int LibCamera::start() {
|
||||||
this->streamName_.clear();
|
|
||||||
for (unsigned int index = 0; index < this->config_->size(); ++index) {
|
for (unsigned int index = 0; index < this->config_->size(); ++index) {
|
||||||
StreamConfiguration &cfg = this->config_->at(index);
|
StreamConfiguration &cfg = this->config_->at(index);
|
||||||
this->streamName_[cfg.stream()] = "stream" + std::to_string(index);
|
this->streamName_[cfg.stream()] = "stream" + std::to_string(index);
|
||||||
|
|
@ -536,6 +535,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
this->item_free_fn();
|
this->item_free_fn();
|
||||||
|
this->requests_.clear();
|
||||||
|
this->streamName_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibCamera::close() {
|
void LibCamera::close() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue