Author: benny Date: 2006-07-27 21:21:25 +0000 (Thu, 27 Jul 2006) New Revision: 22537
Modified: thunar/trunk/ChangeLog thunar/trunk/configure.in.in thunar/trunk/thunar-vfs/thunar-vfs-thumb-pixbuf.c Log: 2006-07-27 Benedikt Meurer <[EMAIL PROTECTED]> * thunar-vfs/thunar-vfs-thumb-pixbuf.c(thunar_vfs_thumb_pixbuf_load): Properly close the pixbuf loader prior to releasing it, even if the pixbuf wasn't loaded successfully. * configure.in.in: The glibc specified work-arounds break other the build on other systems. Instead try to guess whether glibc-style work-arounds are required. Modified: thunar/trunk/ChangeLog =================================================================== --- thunar/trunk/ChangeLog 2006-07-27 20:30:20 UTC (rev 22536) +++ thunar/trunk/ChangeLog 2006-07-27 21:21:25 UTC (rev 22537) @@ -1,5 +1,14 @@ 2006-07-27 Benedikt Meurer <[EMAIL PROTECTED]> + * thunar-vfs/thunar-vfs-thumb-pixbuf.c(thunar_vfs_thumb_pixbuf_load): + Properly close the pixbuf loader prior to releasing it, even if the + pixbuf wasn't loaded successfully. + * configure.in.in: The glibc specified work-arounds break other the + build on other systems. Instead try to guess whether glibc-style + work-arounds are required. + +2006-07-27 Benedikt Meurer <[EMAIL PROTECTED]> + * configure.in.in, thunar-vfs/thunar-vfs-io-local-xfer.c, tdb/Makefile.am: Work-around various glibc oddities. Modified: thunar/trunk/configure.in.in =================================================================== --- thunar/trunk/configure.in.in 2006-07-27 20:30:20 UTC (rev 22536) +++ thunar/trunk/configure.in.in 2006-07-27 21:21:25 UTC (rev 22537) @@ -96,8 +96,6 @@ dnl *********************************************** dnl *** Work-around system-specific limitations *** dnl *********************************************** -AC_DEFINE([_XOPEN_SOURCE], [600], [Required to make glibc usable]) -AC_DEFINE([_BSD_SOURCE], [1], [Required to make glibc usable]) AC_SYS_LARGEFILE() dnl ********************************** @@ -117,9 +115,47 @@ AC_FUNC_MMAP() AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr lchmod localeconv \ localtime_r mbrtowc mkfifo posix_madvise pread pwrite \ - readdir_r sched_yield setgroupent setpassent statfs \ - statvfs strcoll strlcpy strptime symlink]) + readdir_r sched_yield setgroupent setpassent statfs \ + statvfs strcoll strlcpy strptime symlink]) +dnl ****************************************** +dnl *** Linux/glibc specified work-arounds *** +dnl ****************************************** +m4_define([glibc_workaround_test], +[ +posix_madvise (0, 0, POSIX_MADV_NORMAL); +posix_madvise (0, 0, POSIX_MADV_SEQUENTIAL); +posix_madvise (0, 0, POSIX_MADV_RANDOM); +posix_madvise (0, 0, POSIX_MADV_WILLNEED); +posix_madvise (0, 0, POSIX_MADV_DONTNEED); +strptime (0, 0, 0); +dirfd (0); +]) +AC_MSG_CHECKING([whether we need _BSD_SOURCE and _XOPEN_SOURCE]) +AC_TRY_LINK([#include <sys/types.h> +#include <sys/mman.h> +#include <dirent.h> +#include <time.h>], glibc_workaround_test(), +[ + AC_MSG_RESULT([no]) +], +[ + AC_TRY_LINK([#define _XOPEN_SOURCE 600 +#define _BSD_SOURCE +#include <sys/types.h> +#include <sys/mman.h> +#include <dirent.h> +#include <time.h>], glibc_workaround_test(), + [ + AC_DEFINE([_XOPEN_SOURCE], [600], [Required to unbreak glibc]) + AC_DEFINE([_BSD_SOURCE], [1], [Required to unbreak glibc]) + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + ]) +]) + dnl ****************************** dnl *** Check for i18n support *** dnl ****************************** Modified: thunar/trunk/thunar-vfs/thunar-vfs-thumb-pixbuf.c =================================================================== --- thunar/trunk/thunar-vfs/thunar-vfs-thumb-pixbuf.c 2006-07-27 20:30:20 UTC (rev 22536) +++ thunar/trunk/thunar-vfs/thunar-vfs-thumb-pixbuf.c 2006-07-27 21:21:25 UTC (rev 22537) @@ -113,7 +113,7 @@ GdkPixbufLoader *loader; struct stat statb; GdkPixbuf *pixbuf = NULL; - gboolean succeed; + gboolean succeed = FALSE; guchar *buffer; gint fd; gint n; @@ -144,6 +144,11 @@ if (G_UNLIKELY (buffer == MAP_FAILED)) goto nommap; + /* tell the kernel that we'll read sequentially */ +#ifdef HAVE_POSIX_MADVISE + posix_madvise (buffer, statb.st_size, POSIX_MADV_SEQUENTIAL); +#endif + /* feed the data into the loader */ succeed = gdk_pixbuf_loader_write (loader, buffer, statb.st_size, NULL); @@ -177,11 +182,8 @@ } #endif - /* tell the loader that we're done */ - succeed = (succeed && gdk_pixbuf_loader_close (loader, NULL)); - /* check if we succeed */ - if (G_LIKELY (succeed)) + if (G_LIKELY (succeed && gdk_pixbuf_loader_close (loader, NULL))) { /* determine the pixbuf... */ pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); @@ -194,6 +196,9 @@ end2: close (fd); end1: + /* need to close the loader first if we failed */ + if (G_UNLIKELY (!succeed)) + gdk_pixbuf_loader_close (loader, NULL); g_object_unref (G_OBJECT (loader)); end0: return pixbuf; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits