[evolution-patches] Bug 310488. Hang when draging an image over the image-chooser in the contact editor
- From: Diego Gonzalez <diego pemas net>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] Bug 310488. Hang when draging an image over the image-chooser in the contact editor
- Date: Fri, 22 Jul 2005 13:41:29 +0200
Hi
This patch fixes a hang that happends when you drag and image over the
image-chooser button in the contact editor. This hang seems to be there
since the begining of times. I just found it because i stole the code
for this widget to use it in the Gnome-about-me control center capplet.
I fixed is already corrected in the code that i'm using in the capplet.
Diego
PD: I'm not subscribed to this list, so please, include my email when
answering.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.361
diff -u -r1.361 ChangeLog
--- ChangeLog 11 Jul 2005 08:44:02 -0000 1.361
+++ ChangeLog 15 Jul 2005 13:13:55 -0000
@@ -1,3 +1,12 @@
+2005-07-15 Diego Gonzalez <diego pemas net>
+
+ * e-image-chooser.c (image_drag_data_received_cb) modificatio to
+ avoid getting into an infinite loop. Also remove some debug
+ output.
+ (set_image_from_data): substitute calls to gdk_pixbuf_unref and
+ gdk_pixbuf_ref and use g_object_ref/unref instead. The first ones
+ are deprecated API.
+
2005-07-11 Srinivasa Ragavan <sragavan novell com>
* Makefile.am: Added e-attachment-bar.[ch] e-attachment.[ch]
Index: e-image-chooser.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-image-chooser.c,v
retrieving revision 1.3
diff -u -r1.3 e-image-chooser.c
--- e-image-chooser.c 3 Feb 2004 02:32:29 -0000 1.3
+++ e-image-chooser.c 15 Jul 2005 13:13:55 -0000
@@ -236,7 +236,7 @@
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf)
- gdk_pixbuf_ref (pixbuf);
+ g_object_ref (pixbuf);
gdk_pixbuf_loader_close (loader, NULL);
g_object_unref (loader);
@@ -306,11 +306,11 @@
chooser->priv->image_height / 2 - new_height / 2);
gtk_image_set_from_pixbuf (GTK_IMAGE (chooser->priv->image), composite);
- gdk_pixbuf_unref (scaled);
- gdk_pixbuf_unref (composite);
+ g_object_unref (scaled);
+ g_object_unref (composite);
}
- gdk_pixbuf_unref (pixbuf);
+ g_object_unref (pixbuf);
g_free (chooser->priv->image_buf);
chooser->priv->image_buf = data;
@@ -408,8 +408,6 @@
target_type = gdk_atom_name (selection_data->target);
- printf ("target_type == %s\n", target_type);
-
if (!strcmp (target_type, URI_LIST_TYPE)) {
GnomeVFSResult result;
GnomeVFSHandle *handle;
@@ -423,33 +421,22 @@
else
uri = g_strdup (selection_data->data);
- printf ("uri == %s\n", uri);
-
result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_READ);
if (result == GNOME_VFS_OK) {
result = gnome_vfs_get_file_info_from_handle (handle, &info, GNOME_VFS_FILE_INFO_DEFAULT);
if (result == GNOME_VFS_OK) {
- GnomeVFSFileSize num_left;
GnomeVFSFileSize num_read;
- GnomeVFSFileSize total_read;
- printf ("file size = %d\n", (int)info.size);
buf = g_malloc (info.size);
- num_left = info.size;
- total_read = 0;
-
- while ((result = gnome_vfs_read (handle, buf + total_read, num_left, &num_read)) == GNOME_VFS_OK) {
- num_left -= num_read;
- total_read += num_read;
- }
-
- printf ("read %d bytes\n", (int)total_read);
- if (set_image_from_data (chooser, buf, total_read)) {
- handled = TRUE;
- }
- else {
- /* XXX we should pop up a warning dialog here */
+ if ((result = gnome_vfs_read (handle, buf, info.size, &num_read)) == GNOME_VFS_OK) {
+ if (set_image_from_data (chooser, buf, num_read)) {
+ handled = TRUE;
+ } else {
+ /* XXX we should pop up a warning dialog here */
+ g_free (buf);
+ }
+ } else {
g_free (buf);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]