mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 01:27:12 +00:00
Use utils.hpp for allocating/removing priv field
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
b86f6e9a53
commit
1ac616c4a3
@ -74,16 +74,10 @@ CursorChannelClient::CursorChannelClient(RedChannel *channel,
|
||||
RedChannelCapabilities *caps):
|
||||
CommonGraphicsChannelClient(channel, client, stream, caps)
|
||||
{
|
||||
priv = new CursorChannelClientPrivate();
|
||||
ring_init(&priv->cursor_cache_lru);
|
||||
priv->cursor_cache_available = CLIENT_CURSOR_CACHE_SIZE;
|
||||
}
|
||||
|
||||
CursorChannelClient::~CursorChannelClient()
|
||||
{
|
||||
delete priv;
|
||||
}
|
||||
|
||||
CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient *client, RedStream *stream,
|
||||
int mig_target,
|
||||
RedChannelCapabilities *caps)
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "red-channel-client.h"
|
||||
#include "red-stream.h"
|
||||
#include "cursor-channel.h"
|
||||
#include "utils.hpp"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -31,15 +32,13 @@ struct CursorChannelClientPrivate;
|
||||
|
||||
class CursorChannelClient final: public CommonGraphicsChannelClient
|
||||
{
|
||||
protected:
|
||||
~CursorChannelClient();
|
||||
public:
|
||||
CursorChannelClient(RedChannel *channel,
|
||||
RedClient *client,
|
||||
RedStream *stream,
|
||||
RedChannelCapabilities *caps);
|
||||
virtual void on_disconnect() override;
|
||||
CursorChannelClientPrivate *priv = nullptr;
|
||||
red::unique_link<CursorChannelClientPrivate> priv;
|
||||
};
|
||||
|
||||
CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
|
||||
|
||||
@ -37,9 +37,9 @@ DisplayChannelClient::DisplayChannelClient(DisplayChannel *display,
|
||||
SpiceImageCompression image_compression,
|
||||
spice_wan_compression_t jpeg_state,
|
||||
spice_wan_compression_t zlib_glz_state):
|
||||
CommonGraphicsChannelClient(RED_CHANNEL(display), client, stream, caps, true)
|
||||
CommonGraphicsChannelClient(RED_CHANNEL(display), client, stream, caps, true),
|
||||
priv(new DisplayChannelClientPrivate)
|
||||
{
|
||||
priv = new DisplayChannelClientPrivate;
|
||||
|
||||
// XXX from display_channel_client_init, put somewhere else
|
||||
ring_init(&priv->palette_cache_lru);
|
||||
@ -68,7 +68,6 @@ DisplayChannelClient::~DisplayChannelClient()
|
||||
{
|
||||
g_clear_pointer(&priv->preferred_video_codecs, g_array_unref);
|
||||
g_clear_pointer(&priv->client_preferred_video_codecs, g_array_unref);
|
||||
g_free(priv);
|
||||
}
|
||||
|
||||
static RedSurfaceCreateItem *red_surface_create_item_new(RedChannel* channel,
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "pixmap-cache.h"
|
||||
#include "display-limits.h"
|
||||
#include "common-graphics-channel.h"
|
||||
#include "utils.hpp"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -46,7 +47,7 @@ public:
|
||||
virtual bool config_socket() override;
|
||||
virtual void on_disconnect() override;
|
||||
|
||||
DisplayChannelClientPrivate *priv = nullptr;
|
||||
red::unique_link<DisplayChannelClientPrivate> priv;
|
||||
|
||||
int is_low_bandwidth;
|
||||
};
|
||||
|
||||
@ -532,17 +532,11 @@ MainChannelClient::MainChannelClient(MainChannel *channel,
|
||||
RedStream *stream,
|
||||
RedChannelCapabilities *caps,
|
||||
uint32_t connection_id):
|
||||
RedChannelClient(RED_CHANNEL(channel), client, stream, caps),
|
||||
priv(new MainChannelClientPrivate())
|
||||
RedChannelClient(RED_CHANNEL(channel), client, stream, caps)
|
||||
{
|
||||
priv->connection_id = connection_id;
|
||||
}
|
||||
|
||||
MainChannelClient::~MainChannelClient()
|
||||
{
|
||||
delete priv;
|
||||
}
|
||||
|
||||
MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient *client,
|
||||
RedStream *stream, uint32_t connection_id,
|
||||
RedChannelCapabilities *caps)
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "red-channel-client.h"
|
||||
#include "main-channel.h"
|
||||
#include "utils.hpp"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -29,8 +30,6 @@ struct MainChannelClientPrivate;
|
||||
|
||||
class MainChannelClient final: public RedChannelClient
|
||||
{
|
||||
protected:
|
||||
~MainChannelClient();
|
||||
public:
|
||||
MainChannelClient(MainChannel *channel,
|
||||
RedClient *client,
|
||||
@ -41,7 +40,7 @@ public:
|
||||
virtual uint8_t *alloc_recv_buf(uint16_t type, uint32_t size) override;
|
||||
virtual void release_recv_buf(uint16_t type, uint32_t size, uint8_t *msg) override;
|
||||
virtual void on_disconnect() override;
|
||||
MainChannelClientPrivate *const priv = nullptr;
|
||||
red::unique_link<MainChannelClientPrivate> priv;
|
||||
};
|
||||
|
||||
MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient *client,
|
||||
|
||||
@ -358,9 +358,11 @@ RedChannelClientPrivate::~RedChannelClientPrivate()
|
||||
}
|
||||
}
|
||||
|
||||
/* This even empty is better to by declared here to make sure
|
||||
* we call the right delete for priv field
|
||||
*/
|
||||
RedChannelClient::~RedChannelClient()
|
||||
{
|
||||
delete priv;
|
||||
}
|
||||
|
||||
RedChannelClient::RedChannelClient(RedChannel *channel,
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "red-pipe-item.h"
|
||||
#include "red-stream.h"
|
||||
#include "red-channel.h"
|
||||
#include "utils.hpp"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -183,7 +184,7 @@ private:
|
||||
/* Private data */
|
||||
private:
|
||||
gint _ref = 1;
|
||||
RedChannelClientPrivate *const priv = nullptr;
|
||||
red::unique_link<RedChannelClientPrivate> priv;
|
||||
};
|
||||
|
||||
#define SPICE_SERVER_ERROR spice_server_error_quark()
|
||||
|
||||
@ -46,8 +46,7 @@ SmartCardChannelClient::SmartCardChannelClient(RedChannel *channel,
|
||||
RedClient *client,
|
||||
RedStream *stream,
|
||||
RedChannelCapabilities *caps):
|
||||
RedChannelClient(channel, client, stream, caps),
|
||||
priv(new SmartCardChannelClientPrivate())
|
||||
RedChannelClient(channel, client, stream, caps)
|
||||
{
|
||||
}
|
||||
|
||||
@ -57,7 +56,6 @@ SmartCardChannelClient::~SmartCardChannelClient()
|
||||
g_object_remove_weak_pointer(G_OBJECT(priv->smartcard),
|
||||
(gpointer*)&priv->smartcard);
|
||||
}
|
||||
delete priv;
|
||||
}
|
||||
|
||||
SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel,
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#define SMARTCARD_CHANNEL_CLIENT_H_
|
||||
|
||||
#include "smartcard.h"
|
||||
#include "utils.hpp"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -29,7 +30,7 @@ class SmartCardChannelClient final: public RedChannelClient
|
||||
protected:
|
||||
~SmartCardChannelClient();
|
||||
public:
|
||||
SmartCardChannelClientPrivate *const priv = nullptr;
|
||||
red::unique_link<SmartCardChannelClientPrivate> priv;
|
||||
SmartCardChannelClient(RedChannel *channel,
|
||||
RedClient *client,
|
||||
RedStream *stream,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user