From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24771 invoked by alias); 8 Aug 2003 22:07:07 -0000 Mailing-List: contact guile-gtk-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: guile-gtk-owner@sources.redhat.com Received: (qmail 24764 invoked from network); 8 Aug 2003 22:07:05 -0000 Received: from unknown (HELO snoopy.pacific.net.au) (61.8.0.36) by sources.redhat.com with SMTP; 8 Aug 2003 22:07:05 -0000 Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) by snoopy.pacific.net.au (8.12.3/8.12.3/Debian-6.4) with ESMTP id h78M740J017827 for ; Sat, 9 Aug 2003 08:07:04 +1000 Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h78M74Ch006005 for ; Sat, 9 Aug 2003 08:07:04 +1000 (EST) Received: from localhost (ppp24.dyn228.pacific.net.au [203.143.228.24]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h78M72Ps019945 for ; Sat, 9 Aug 2003 08:07:03 +1000 (EST) Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19lFNp-0000b2-00; Sat, 09 Aug 2003 08:06:49 +1000 To: guile-gtk@sources.redhat.com Subject: gdk-selection-property-get (was: Selection and DND completed) References: <87d6i9miga.fsf@zip.com.au> <874r3lkzbd.fsf@zip.com.au> From: Kevin Ryde Mail-Copies-To: never Date: Fri, 08 Aug 2003 22:07:00 -0000 Message-ID: <87d6ffdcsm.fsf@zip.com.au> User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2003-q3/txt/msg00032.txt.bz2 --=-=-= Content-length: 469 Marko Rauhamaa writes: > > I set *prop_type to GDK_NONE and *prop_format to > 8 (sic) in case of failure. I think it'd be better as 0 to mean sort of no format at all, * gdk-support.c (gdk_selection_property_get_interp): Tweak to initialize prop_type and prop_format unconditionally, so as not to depend on gdk_selection_property_get at all for this. Use 0 for prop_format not given by gdk_selection_property_get. --=-=-= Content-Disposition: attachment; filename=gdk-support.c.property-get.diff Content-length: 1142 --- gdk-support.c.~1.30.~ 2003-08-05 10:32:59.000000000 +1000 +++ gdk-support.c 2003-08-08 15:51:13.000000000 +1000 @@ -30,18 +30,24 @@ gdk_selection_property_get_interp (GdkWindow *requestor, GdkAtom *prop_type, int *prop_format) { - /* We need to initialize data to NULL because the GDK function returns - * a random value in data if requestor has been destroyed. */ - guchar *data = NULL; + guchar *data; int length; + + /* When the requestor window has been destroyed, it looks like + gdk_selection_property_get doesn't store anything in its return + locations. Initialize here to be sure. */ + data = NULL; + *prop_type = GTK_NONE; + *prop_format = 0; + length = gdk_selection_property_get (requestor, &data, prop_type, prop_format); /* Note: While we are returning a string, the data may actually be * anything and contain zeros. */ - if (data) return scm_take_str (data, length); - *prop_type = GDK_NONE; - *prop_format = 8; - return SCM_BOOL_F; + if (data) + return scm_take_str (data, length); + else + return SCM_BOOL_F; } #define FUNCNAME "gdk-property-change" --=-=-=--