summaryrefslogtreecommitdiffstats
path: root/unix/tkUnix.c
diff options
context:
space:
mode:
authorrmax <rmax>2005-06-02 10:07:52 (GMT)
committerrmax <rmax>2005-06-02 10:07:52 (GMT)
commit5ed930b5fa9ee7132f552bf0fa5965a7a5b3b548 (patch)
tree278534cf9e3258fd3cb769b428e03e433c52e222 /unix/tkUnix.c
parent385daea219457a69f8004ca242fbecc99b113eff (diff)
downloadtk-5ed930b5fa9ee7132f552bf0fa5965a7a5b3b548.zip
tk-5ed930b5fa9ee7132f552bf0fa5965a7a5b3b548.tar.gz
tk-5ed930b5fa9ee7132f552bf0fa5965a7a5b3b548.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.
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;
}