mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-08 21:14:11 +00:00
Remove some red_pipe_item_(un)ref usage
Replace with smart pointers instead. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@gmail.com>
This commit is contained in:
parent
93405ae3c6
commit
bd6d043152
@ -48,13 +48,7 @@ RedCursorPipeItem::~RedCursorPipeItem()
|
||||
|
||||
static void cursor_channel_set_item(CursorChannel *cursor, RedCursorPipeItem *item)
|
||||
{
|
||||
if (item) {
|
||||
red_pipe_item_ref(item);
|
||||
}
|
||||
if (cursor->item) {
|
||||
red_pipe_item_unref(cursor->item);
|
||||
}
|
||||
cursor->item = item;
|
||||
cursor->item.reset(item);
|
||||
}
|
||||
|
||||
static void cursor_fill(CursorChannelClient *ccc, RedCursorPipeItem *cursor,
|
||||
@ -101,7 +95,7 @@ static void red_marshall_cursor_init(CursorChannelClient *ccc, SpiceMarshaller *
|
||||
msg.trail_length = cursor_channel->cursor_trail_length;
|
||||
msg.trail_frequency = cursor_channel->cursor_trail_frequency;
|
||||
|
||||
cursor_fill(ccc, cursor_channel->item, &msg.cursor, base_marshaller);
|
||||
cursor_fill(ccc, cursor_channel->item.get(), &msg.cursor, base_marshaller);
|
||||
spice_marshall_msg_cursor_init(base_marshaller, &msg);
|
||||
}
|
||||
|
||||
@ -308,9 +302,6 @@ void CursorChannel::on_connect(RedClient *client, RedStream *stream, int migrati
|
||||
|
||||
CursorChannel::~CursorChannel()
|
||||
{
|
||||
if (item) {
|
||||
red_pipe_item_unref(item);
|
||||
}
|
||||
}
|
||||
|
||||
CursorChannel::CursorChannel(RedsState *reds, uint32_t id,
|
||||
|
||||
@ -43,7 +43,7 @@ struct CursorChannel final: public CommonGraphicsChannel
|
||||
void on_connect(RedClient *client, RedStream *stream, int migration,
|
||||
RedChannelCapabilities *caps) override;
|
||||
|
||||
RedCursorPipeItem *item;
|
||||
red::shared_ptr<RedCursorPipeItem> item;
|
||||
bool cursor_visible = true;
|
||||
SpicePoint16 cursor_position;
|
||||
uint16_t cursor_trail_length;
|
||||
|
||||
@ -1564,7 +1564,6 @@ void RedChannelClient::set_header_sub_list(uint32_t sub_list)
|
||||
bool RedChannelClient::wait_pipe_item_sent(GList *item_pos, int64_t timeout)
|
||||
{
|
||||
uint64_t end_time;
|
||||
bool item_sent;
|
||||
|
||||
spice_debug("trace");
|
||||
|
||||
@ -1574,11 +1573,10 @@ bool RedChannelClient::wait_pipe_item_sent(GList *item_pos, int64_t timeout)
|
||||
end_time = UINT64_MAX;
|
||||
}
|
||||
|
||||
MarkerPipeItem *mark_item = new MarkerPipeItem();
|
||||
auto mark_item = red::make_shared<MarkerPipeItem>();
|
||||
|
||||
mark_item->item_sent = false;
|
||||
red_pipe_item_ref(mark_item);
|
||||
pipe_add_before_pos(mark_item, item_pos);
|
||||
pipe_add_before_pos(mark_item.get(), item_pos);
|
||||
|
||||
for (;;) {
|
||||
receive();
|
||||
@ -1590,15 +1588,11 @@ bool RedChannelClient::wait_pipe_item_sent(GList *item_pos, int64_t timeout)
|
||||
usleep(CHANNEL_BLOCKED_SLEEP_DURATION);
|
||||
}
|
||||
|
||||
item_sent = mark_item->item_sent;
|
||||
red_pipe_item_unref(mark_item);
|
||||
|
||||
if (!item_sent) {
|
||||
if (!mark_item->item_sent) {
|
||||
// still on the queue
|
||||
spice_warning("timeout");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
return mark_item->item_sent;
|
||||
}
|
||||
|
||||
bool RedChannelClient::wait_outgoing_item(int64_t timeout)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user