{
VncJob *job = g_new0(VncJob, 1);
+ assert(vs->magic == VNC_MAGIC);
job->vs = vs;
vnc_lock_queue(queue);
QLIST_INIT(&job->rectangles);
/* Here job can only be NULL if queue->exit is true */
job = QTAILQ_FIRST(&queue->jobs);
vnc_unlock_queue(queue);
+ assert(job->vs->magic == VNC_MAGIC);
if (queue->exit) {
return -1;
/* Make a local copy of vs and switch output buffers */
vnc_async_encoding_start(job->vs, &vs);
+ vs.magic = VNC_MAGIC;
/* Start sending rectangles */
n_rectangles = 0;
vnc_unlock_queue(queue);
qemu_cond_broadcast(&queue->cond);
g_free(job);
+ vs.magic = 0;
return 0;
}
{
VncState *vs = opaque;
+ assert(vs->magic == VNC_MAGIC);
switch (cmd) {
case AUD_CNOTIFY_DISABLE:
vnc_lock_output(vs);
{
VncState *vs = opaque;
+ assert(vs->magic == VNC_MAGIC);
vnc_lock_output(vs);
if (vs->output.offset < vs->throttle_output_offset) {
vnc_write_u8(vs, VNC_MSG_SERVER_QEMU);
vs->ioc = NULL;
object_unref(OBJECT(vs->sioc));
vs->sioc = NULL;
+ vs->magic = 0;
g_free(vs);
}
static void vnc_client_write(VncState *vs)
{
-
+ assert(vs->magic == VNC_MAGIC);
vnc_lock_output(vs);
if (vs->output.offset) {
vnc_client_write_locked(vs);
{
VncState *vs = opaque;
+ assert(vs->magic == VNC_MAGIC);
vnc_jobs_consume_buffer(vs);
}
GIOCondition condition, void *opaque)
{
VncState *vs = opaque;
+
+ assert(vs->magic == VNC_MAGIC);
if (condition & G_IO_IN) {
if (vnc_client_read(vs) < 0) {
/* vs is free()ed here */
void vnc_write(VncState *vs, const void *data, size_t len)
{
+ assert(vs->magic == VNC_MAGIC);
if (vs->disconnecting) {
return;
}
int i;
trace_vnc_client_connect(vs, sioc);
+ vs->magic = VNC_MAGIC;
vs->sioc = sioc;
object_ref(OBJECT(vs->sioc));
vs->ioc = QIO_CHANNEL(sioc);
VNC_STATE_UPDATE_FORCE,
} VncStateUpdate;
+#define VNC_MAGIC ((uint64_t)0x05b3f069b3d204bb)
+
struct VncState
{
+ uint64_t magic;
QIOChannelSocket *sioc; /* The underlying socket */
QIOChannel *ioc; /* The channel currently used for I/O */
guint ioc_tag;