[maemo-commits] [maemo-commits] r13755 - in projects/haf/trunk/sapwood: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Sep 11 16:54:51 EEST 2007
- Previous message: [maemo-commits] r13754 - in projects/haf/trunk/hildon-plugins-settings: . src
- Next message: [maemo-commits] r13756 - in projects/haf/trunk/sapwood: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: tko Date: 2007-09-11 16:54:48 +0300 (Tue, 11 Sep 2007) New Revision: 13755 Modified: projects/haf/trunk/sapwood/ChangeLog projects/haf/trunk/sapwood/src/sapwood-pixmap.c projects/haf/trunk/sapwood/src/sapwood-render.c Log: Resolve symbolic links before using the path as cache key. 2007-09-11 Tommi Komulainen <tommi.komulainen at nokia.com> * src/sapwood-pixmap.c (sapwood_pixmap_get_for_file) * src/sapwood-render.c (theme_pixbuf_set_filename): Resolve symbolic links before using the path as cache key. Otherwise when switching themes the client side can consider old and new files different and request new pixmap for the new theme. The symlink is resolved before making the request to the server, and if it resolves to the same file as the old one, we get a shared handle from the server. And since there's no server side reference counting, releasing the old pixmap will destroy the new one, causing BadPixmap very shortly. (NB#64446) Modified: projects/haf/trunk/sapwood/ChangeLog =================================================================== --- projects/haf/trunk/sapwood/ChangeLog 2007-09-11 13:33:55 UTC (rev 13754) +++ projects/haf/trunk/sapwood/ChangeLog 2007-09-11 13:54:48 UTC (rev 13755) @@ -1,3 +1,16 @@ +2007-09-11 Tommi Komulainen <tommi.komulainen at nokia.com> + + * src/sapwood-pixmap.c (sapwood_pixmap_get_for_file) + * src/sapwood-render.c (theme_pixbuf_set_filename): Resolve symbolic + links before using the path as cache key. Otherwise when switching + themes the client side can consider old and new files different and + request new pixmap for the new theme. The symlink is resolved before + making the request to the server, and if it resolves to the same file + as the old one, we get a shared handle from the server. And since + there's no server side reference counting, releasing the old pixmap + will destroy the new one, causing BadPixmap very shortly. + (NB#64446) + 2007-09-05 Tommi Komulainen <tommi.komulainen at nokia.com> * === Release 2.91.9 === Modified: projects/haf/trunk/sapwood/src/sapwood-pixmap.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-pixmap.c 2007-09-11 13:33:55 UTC (rev 13754) +++ projects/haf/trunk/sapwood/src/sapwood-pixmap.c 2007-09-11 13:54:48 UTC (rev 13755) @@ -25,9 +25,7 @@ #include <errno.h> #include <fcntl.h> -#include <limits.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> @@ -151,18 +149,20 @@ char buf[ sizeof(PixbufOpenRequest) + PATH_MAX + 1 ] = {0}; PixbufOpenRequest *req = (PixbufOpenRequest *) buf; PixbufOpenResponse rep; + int flen; int i, j; /* marshal request */ - if (!realpath (filename, req->filename)) + flen = g_strlcpy (req->filename, filename, PATH_MAX); + if (flen > PATH_MAX) { g_set_error (err, SAPWOOD_PIXMAP_ERROR, SAPWOOD_PIXMAP_ERROR_FAILED, - "%s: realpath: %s", filename, strerror (errno)); + "%s: filename too long", filename); return NULL; } req->base.op = PIXBUF_OP_OPEN; - req->base.length = sizeof(*req) + strlen(req->filename) + 1; + req->base.length = sizeof(*req) + flen + 1; req->border_left = border_left; req->border_right = border_right; req->border_top = border_top; Modified: projects/haf/trunk/sapwood/src/sapwood-render.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-render.c 2007-09-11 13:33:55 UTC (rev 13754) +++ projects/haf/trunk/sapwood/src/sapwood-render.c 2007-09-11 13:54:48 UTC (rev 13755) @@ -23,6 +23,9 @@ */ #include <config.h> +#include <errno.h> +#include <limits.h> +#include <stdlib.h> #include <string.h> #include "theme-pixbuf.h" @@ -130,24 +133,29 @@ if (theme_pb->basename) g_free (theme_pb->basename); + theme_pb->dirname = NULL; + theme_pb->basename = NULL; + if (filename) { - char *dirname; - char *basename; + char abspath[PATH_MAX + 1]; - dirname = g_path_get_dirname (filename); - basename = g_path_get_basename (filename); + if (realpath (filename, abspath)) + { + char *dirname; + char *basename; - theme_pb->dirname = g_quark_to_string (g_quark_from_string (dirname)); - theme_pb->basename = basename; + dirname = g_path_get_dirname (abspath); + basename = g_path_get_basename (abspath); - g_free (dirname); + theme_pb->dirname = g_quark_to_string (g_quark_from_string (dirname)); + theme_pb->basename = basename; + + g_free (dirname); + } + else + g_warning ("%s: %s", filename, g_strerror (errno)); } - else - { - theme_pb->dirname = NULL; - theme_pb->basename = NULL; - } } void
- Previous message: [maemo-commits] r13754 - in projects/haf/trunk/hildon-plugins-settings: . src
- Next message: [maemo-commits] r13756 - in projects/haf/trunk/sapwood: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]