mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-05 00:48:01 +02:00
monitor-utils: clear cam data after creating nodes
The cam_data structure stores a reference to the "parent" WpSpaDevice and doesn't allow it to be destroyed when the monitor detects that the device is no longer present. Clear it right after pushing the event to make sure there's no dangling reference left around Fixes: #627
This commit is contained in:
parent
7856124df0
commit
8ee351838d
1 changed files with 11 additions and 0 deletions
|
|
@ -40,6 +40,15 @@ function mutils.get_cam_data (self, dev_string)
|
|||
return self.cam_data[dev_num], dev_num
|
||||
end
|
||||
|
||||
function mutils.clear_cam_data (self, dev_string)
|
||||
local dev_num = tonumber (dev_string)
|
||||
if not dev_num then
|
||||
return
|
||||
end
|
||||
|
||||
self.cam_data[dev_num] = nil
|
||||
end
|
||||
|
||||
function mutils.create_cam_node (self, dev_num)
|
||||
local api = nil
|
||||
local cam_data = self:get_cam_data (dev_num)
|
||||
|
|
@ -65,6 +74,8 @@ function mutils.create_cam_node (self, dev_num)
|
|||
e:set_data ("node-sub-id", cam_data[api].id)
|
||||
|
||||
EventDispatcher.push_event (e)
|
||||
|
||||
self:clear_cam_data (dev_num)
|
||||
end
|
||||
|
||||
-- arbitrates between v4l2 and libcamera on who gets to create the device node
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue