wireplumber/modules/module-reserve-device/reserve-device.h
Pauli Virtanen b65b53b200 m-reserve-device: cancel get proxy callback properly
Cancel the async calls that get the name of the application owning the
service, when WpReserveDevice is finalized or we are going to make
another call.

Fixes UAF accessing self when the async callback runs.
2024-11-01 20:46:54 +02:00

57 lines
1.2 KiB
C

/* WirePlumber
*
* Copyright © 2021 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_RESERVE_DEVICE_H__
#define __WIREPLUMBER_RESERVE_DEVICE_H__
#include <wp/wp.h>
G_BEGIN_DECLS
typedef enum {
WP_RESERVE_DEVICE_STATE_UNKNOWN = 0,
WP_RESERVE_DEVICE_STATE_BUSY,
WP_RESERVE_DEVICE_STATE_AVAILABLE,
WP_RESERVE_DEVICE_STATE_ACQUIRED,
} WpReserveDeviceState;
G_DECLARE_FINAL_TYPE (WpReserveDevice, wp_reserve_device,
WP, RESERVE_DEVICE, GObject)
struct _WpReserveDevice
{
GObject parent;
GWeakRef plugin;
gchar *name;
gchar *app_name;
gchar *app_dev_name;
gint priority;
gchar *owner_app_name;
gchar *service_name;
gchar *object_path;
GWeakRef transition;
GDBusMethodInvocation *req_rel_invocation;
WpReserveDeviceState state;
guint watcher_id;
guint owner_id;
GCancellable *get_owner_call;
};
void wp_reserve_device_export_object (WpReserveDevice *self);
void wp_reserve_device_unexport_object (WpReserveDevice *self);
void wp_reserve_device_own_name (WpReserveDevice * self, gboolean force);
void wp_reserve_device_unown_name (WpReserveDevice * self);
G_END_DECLS
#endif