[gtk-vnc-devel] [patch] fix a crash



Hi, folks.

I just committed this trivial patch, that avoids a crash if we
disconnect right after connect.

And yes, this [new] crash event was introduced by my last patch for
pixel_format stuff :P

Cheers,
-- 
Jonh Wendell
www.bani.com.br

# HG changeset patch
# User Jonh Wendell <wendell bani com br>
# Date 1212338527 10800
# Node ID 2396ceb7da50933e981f246a96c4a235eccee141
# Parent  d2f220a10a2fd072c97f0b7335594a36916c7d4a
Do more checks if connection is still alive in initialisation.
This fix a crash when closing the connection right after connecting.

diff -r d2f220a10a2f -r 2396ceb7da50 src/gvnc.c
--- a/src/gvnc.c	Fri May 30 16:46:48 2008 -0300
+++ b/src/gvnc.c	Sun Jun 01 13:42:07 2008 -0300
@@ -2784,6 +2784,9 @@ gboolean gvnc_initialize(struct gvnc *gv
 	gvnc->width = gvnc_read_u16(gvnc);
 	gvnc->height = gvnc_read_u16(gvnc);
 
+	if (gvnc_has_error(gvnc))
+		return FALSE;
+
 	gvnc_read_pixel_format(gvnc, &gvnc->fmt);
 
 	n_name = gvnc_read_u32(gvnc);
@@ -2795,6 +2798,9 @@ gboolean gvnc_initialize(struct gvnc *gv
 	gvnc_read(gvnc, gvnc->name, n_name);
 	gvnc->name[n_name] = 0;
 	GVNC_DEBUG("Display name '%s'\n", gvnc->name);
+
+	if (gvnc_has_error(gvnc))
+		return FALSE;
 
 	if (!gvnc->fmt.true_color_flag && gvnc->ops.get_preferred_pixel_format)
 		if (gvnc->ops.get_preferred_pixel_format(gvnc->ops_data, &gvnc->fmt))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]