summaryrefslogtreecommitdiffstats
path: root/unix/tkUnix.c
diff options
context:
space:
mode:
authorrmax <rmax@noemail.net>2005-06-02 10:07:52 (GMT)
committerrmax <rmax@noemail.net>2005-06-02 10:07:52 (GMT)
commit19973d7fedfda237c749a4c4518dd179e382eac6 (patch)
tree278534cf9e3258fd3cb769b428e03e433c52e222 /unix/tkUnix.c
parent7d3a3fb12010f3e43beaa9b926b9661ed908727d (diff)
downloadtk-19973d7fedfda237c749a4c4518dd179e382eac6.zip
tk-19973d7fedfda237c749a4c4518dd179e382eac6.tar.gz
tk-19973d7fedfda237c749a4c4518dd179e382eac6.tar.bz2
* unix/tkUnix.c (Tk_GetUserInactiveTime): Improvements to get it
working on Solaris, and panic if we run out of memory. * unix/configure.in: Rework the searching for Xss, to make it work on Solaris and provide more useful output. Use AC_HELP_STRING where appropriate. * unix/tcl.m4: synced from Tcl. * unix/configure: regenerated with autoconf 2.59. FossilOrigin-Name: fc8a5c9c65a112ddefb328a91b7bbaa39e0a9c6e
Diffstat (limited to 'unix/tkUnix.c')
-rw-r--r--unix/tkUnix.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index 3a28cd3..0f93e93 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnix.c,v 1.9 2005/06/01 18:14:40 rmax Exp $
+ * RCS: @(#) $Id: tkUnix.c,v 1.10 2005/06/02 10:08:07 rmax Exp $
*/
#include <tkInt.h>
@@ -196,11 +196,17 @@ Tk_GetUserInactiveTime(dpy)
#ifdef HAVE_XSS
int eventBase, errorBase, major, minor;
+ /* Calling XScreenSaverQueryVersion seems to be needed to prevent
+ * a crash on some buggy versions of XFree86 */
if (XScreenSaverQueryExtension(dpy, &eventBase, &errorBase) &&
- XScreenSaverQueryVersion(dpy, &major, &minor) &&
- major == 1 && minor == 0 ) {
-
+ XScreenSaverQueryVersion(dpy, &major, &minor)) {
+
XScreenSaverInfo *info = XScreenSaverAllocInfo();
+
+ if (info == NULL) {
+ /* we are out of memory */
+ Tcl_Panic("Out of memory: XScreenSaverAllocInfo failed in Tk_GetUserInactiveTime");
+ }
if (XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info)) {
inactiveTime = info->idle;
}