[gtk-vnc-devel] PATCH: Fix crash in OpenGL scaling code



While getting GTK-VNC to use scaling inside virt-manager, I hit one annoying
crash bug. virt-manager will show the widget before the VNC connection has
neccessarily connected. This results in a crash at

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912496259456 (LWP 2816)]
rescale_display (obj=0x1486570, width=640, height=392) at vncdisplay.c:959
959             for (j = 0; j < image->height; j++) {
(gdb) bt
#0  rescale_display (obj=0x1486570, width=640, height=392) at vncdisplay.c:959
#1  0x00002aaab541e75c in configure_event (widget=0x1486570, configure=<value optimized out>, data=<value optimized out>)
    at vncdisplay.c:1087
#2  0x0000003eeafa06e5 in _gtk_marshal_BOOLEAN__BOXED (closure=0x13a3e90, return_value=0x7fff3ac9fc30, n_param_values=2, 
    param_values=0x7fff3ac9fd20, invocation_hint=0x7fff3ac9fbf0, marshal_data=0x0) at gtkmarshalers.c:84
#3  0x0000003ee720b1a9 in g_closure_invoke () from /lib64/libgobject-2.0.so.0
#4  0x0000003ee721a831 in ?? () from /lib64/libgobject-2.0.so.0
#5  0x0000003ee721ba47 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0


THe patch is simple - skip doing anything in the configure_event method
if we've not got a connection yet


diff -r 02bc30c3e8f6 src/vncdisplay.c
--- a/src/vncdisplay.c	Wed Mar 05 19:21:36 2008 -0600
+++ b/src/vncdisplay.c	Thu Mar 06 17:50:12 2008 -0500
@@ -1084,6 +1084,12 @@ static gboolean configure_event(GtkWidge
 static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *configure,
 				gpointer data G_GNUC_UNUSED)
 {
+	VncDisplay *obj = VNC_DISPLAY(widget);
+	VncDisplayPrivate *priv = obj->priv;
+
+	if (priv->fb.data == NULL)
+		return FALSE;
+
 	rescale_display(VNC_DISPLAY(widget),
 			configure->width, configure->height);
 	

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




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