[Xquartz-changes] xserver: Branch 'master' - 5 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Sun Mar 4 23:48:52 PST 2012


 configure.ac                                                  |    4 
 dix/getevents.c                                               |   19 +++-
 hw/dmx/dmxinit.c                                              |    2 
 hw/dmx/dmxlog.c                                               |    3 
 hw/kdrive/src/kdrive.c                                        |    2 
 hw/vfb/InitOutput.c                                           |    2 
 hw/xfree86/common/xf86Init.c                                  |    2 
 hw/xnest/Init.c                                               |    2 
 hw/xquartz/X11Application.h                                   |    2 
 hw/xquartz/X11Application.m                                   |   43 ++++++++++
 hw/xquartz/bundle/Resources/English.lproj/Localizable.strings |binary
 hw/xquartz/darwin.c                                           |    6 -
 hw/xwin/winerror.c                                            |    2 
 include/os.h                                                  |    2 
 os/log.c                                                      |   16 ++-
 test/.gitignore                                               |    1 
 test/ddxstubs.c                                               |    2 
 test/xi2/.gitignore                                           |    1 
 18 files changed, 86 insertions(+), 25 deletions(-)

New commits:
commit 24922b6b20908b9fb366a96ae9d24770e5d0077c
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 13:15:12 2012 -0800

    XQuartz: Detect FatalErrors on startup to prevent tight crash loops
    
    If a FatalError occurs before the server finishes launching, it will
    not have drained the launchd-owned DISPLAY socket, so launchd will
    just relaunch it.  This can cause the server to crash in a tight loop
    which will spam the user with CrashReporter windows that claim focus on
    appearance.
    
    This allows users stuck in this loop to "deal" with the problem without
    popping up a crash report every 10 seconds.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index baee29d..29ead50 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -76,6 +76,8 @@ void X11ApplicationLaunchClient (const char *cmd);
 
 Bool X11ApplicationCanEnterRandR (void);
 
+void X11ApplicationFatalError(const char *f, va_list args) __printflike(1, 0);
+
 void X11ApplicationMain(int argc, char **argv, char **envp);
 
 #define PREFS_APPSMENU              "apps_menu"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 048e787..b21be39 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -69,6 +69,7 @@ static dispatch_queue_t eventTranslationQueue;
 #endif
 
 extern Bool noTestExtensions;
+extern BOOL serverRunning;
 
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 static TISInputSourceRef last_key_layout;
@@ -940,6 +941,48 @@ Bool X11ApplicationCanEnterRandR(void) {
     }
 }
 
+void X11ApplicationFatalError(const char *f, va_list args) {
+#ifdef HAVE_LIBDISPATCH
+    NSString *title, *msg;
+    char *error_msg;
+
+    /* This is called by FatalError() in the server thread just before
+     * we would abort.  If the server never got off the ground, We should
+     * inform the user of the error rather than letting the ever-so-friendly
+     * CrashReporter do it for us.
+     *
+     * This also has the benefit of forcing user interaction rather than
+     * allowing an infinite throttled-restart if the crash occurs before
+     * we can drain the launchd socket.
+     */
+
+    if (serverRunning) {
+        return;
+    }
+
+    title = NSLocalizedString(@"The application X11 could not be opened.",
+                              @"Dialog title when encountering a fatal error");
+    msg = NSLocalizedString(@"An error occurred while starting the X11 server: \"%s\"\n\nClick Quit to quit X11. Click Report to see more details or send a report to Apple.",
+                            @"Dialog when encountering a fatal error");
+
+    vasprintf(&error_msg, f, args);
+    msg = [NSString stringWithFormat:msg, error_msg];
+
+    /* We want the AppKit thread to actually service the alert or we will race [NSApp run] and create an
+     * 'NSInternalInconsistencyException', reason: 'NSApp with wrong _running count'
+     */
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        if (NSAlertDefaultReturn == NSRunAlertPanel(title, msg, NSLocalizedString(@"Quit", @""),
+                                                    NSLocalizedString (@"Report...", @""), nil)) {
+            exit(EXIT_FAILURE);
+        }
+    });
+
+    /* fall back to caller to do the abort() in the DIX */
+#endif
+}
+
+
 static void check_xinitrc (void) {
     char *tem, buf[1024];
     NSString *msg;
diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings
index bf2089c..36ae0ff 100644
Binary files a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings and b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings differ
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 5d2da03..c713cc1 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -77,6 +77,8 @@
 #include "quartzKeyboard.h"
 #include "quartz.h"
 
+#include "X11Application.h"
+
 aslclient aslc;
 
 void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
@@ -607,7 +609,7 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
  */
 void OsVendorFatalError(const char *f, va_list args)
 {
-    ErrorF( "   OsVendorFatalError\n" );
+    X11ApplicationFatalError(f, args);
 }
 
 
commit 19283e1947edf9b25c9ee72ae30defabab670f20
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 12:35:02 2012 -0800

    os: Pass the FatalError message to OsVendorFatalError
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 57c2425..9388833 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -855,7 +855,7 @@ void OsVendorInit(void)
  * OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
  * two routines mentioned here, as well as by others) to use the
  * referenced routine instead of \a vfprintf().) */
-void OsVendorFatalError(void)
+void OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/dmx/dmxlog.c b/hw/dmx/dmxlog.c
index 94b8035..0ebe9f9 100644
--- a/hw/dmx/dmxlog.c
+++ b/hw/dmx/dmxlog.c
@@ -102,9 +102,6 @@ static void VFatalError(const char *format, va_list args)
 {
     VErrorF(format, args);
     ErrorF("\n");
-#ifdef DDXOSFATALERROR
-    OsVendorFatalError();
-#endif
     AbortServer();
     /*NOTREACHED*/
 }
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index f6cc351..5d69830 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1167,7 +1167,7 @@ KdInitOutput (ScreenInfo    *pScreenInfo,
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index e1af5a4..71c7b6d 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -219,7 +219,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 5263b5f..56550c9 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1036,7 +1036,7 @@ AbortDDX(enum ExitCode error)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 #ifdef VENDORSUPPORT
     ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index af57518..b7e76b5 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -138,7 +138,7 @@ void OsVendorInit(void)
     return;
 }
 
-void OsVendorFatalError(void)
+void OsVendorFatalError(const char *f, va_list args)
 {
     return;
 }
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 465a96d..5d2da03 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -605,7 +605,7 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
 /*
  * OsVendorFatalError
  */
-void OsVendorFatalError( void )
+void OsVendorFatalError(const char *f, va_list args)
 {
     ErrorF( "   OsVendorFatalError\n" );
 }
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 0440d13..82ab382 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -71,7 +71,7 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
  * Attempt to do last-ditch, safe, important cleanup here.
  */
 void
-OsVendorFatalError (void)
+OsVendorFatalError (const char *f, va_list args)
 {
   /* Don't give duplicate warning if UseMsg was called */
   if (g_fSilentFatalError)
diff --git a/include/os.h b/include/os.h
index 48ce329..ae7a6f1 100644
--- a/include/os.h
+++ b/include/os.h
@@ -296,7 +296,7 @@ extern _X_EXPORT void OsInit(void);
 
 extern _X_EXPORT void OsCleanup(Bool);
 
-extern _X_EXPORT void OsVendorFatalError(void);
+extern _X_EXPORT void OsVendorFatalError(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);;
 
 extern _X_EXPORT void OsVendorInit(void);
 
diff --git a/os/log.c b/os/log.c
index 671a01b..cdff7d1 100644
--- a/os/log.c
+++ b/os/log.c
@@ -585,6 +585,7 @@ void
 FatalError(const char *f, ...)
 {
     va_list args;
+    va_list args2;
     static Bool beenhere = FALSE;
 
     if (beenhere)
@@ -592,20 +593,23 @@ FatalError(const char *f, ...)
     else
 	ErrorF("\nFatal server error:\n");
 
-    va_start(args, f);
+    /* Make a copy for OsVendorFatalError */
+    va_copy(args2, args);
+
 #ifdef __APPLE__
     {
-        va_list args2;
-        va_copy(args2, args);
-        (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args2);
-        va_end(args2);
+        va_list apple_args;
+        va_copy(apple_args, args);
+        (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, apple_args);
+        va_end(apple_args);
     }
 #endif
     VErrorF(f, args);
     va_end(args);
     ErrorF("\n");
     if (!beenhere)
-	OsVendorFatalError();
+	OsVendorFatalError(f, args2);
+    va_end(args2);
     if (!beenhere) {
 	beenhere = TRUE;
 	AbortServer();
diff --git a/test/ddxstubs.c b/test/ddxstubs.c
index baf2a7a..afaadfc 100644
--- a/test/ddxstubs.c
+++ b/test/ddxstubs.c
@@ -43,7 +43,7 @@ void ProcessInputEvents(void) {
 void OsVendorInit(void) {
 }
 
-void OsVendorFatalError(void) {
+void OsVendorFatalError(const char *f, va_list args) {
 }
 
 void AbortDDX(enum ExitCode error) {
commit b1be72c5ca6cb98ba64637990b142be0f1710a19
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Mar 4 20:26:18 2012 -0800

    Version bumped to 1.12
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index a44a12a..2693ce7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.11.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-02-11"
+AC_INIT([xorg-server], 1.12.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-03-04"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit e08ed0b757b9b48344a301f612fabb3e39ffec78
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Feb 26 17:51:50 2012 -0500

    test: add new test cases to .gitignore
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/test/.gitignore b/test/.gitignore
index e5aa9ec..5d4fdfa 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -3,6 +3,7 @@ input
 list
 misc
 string
+touch
 xfree86
 xkb
 xtest
diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore
index 3e9816d..817aa7b 100644
--- a/test/xi2/.gitignore
+++ b/test/xi2/.gitignore
@@ -8,3 +8,4 @@ protocol-xiqueryversion
 protocol-xiselectevents
 protocol-xisetclientpointer
 protocol-xiwarppointer
+xi2
commit 2416ee4a015068359807a10f433e8c54192c78a9
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Feb 22 15:32:56 2012 +1000

    dix: avoid NULL-pointer dereference on button-only devices (#38313)
    
    And for such devices simply take the last.valuators[] which must be valid at
    all times anyway. UpdateSlaveDeviceCoords takes care of that.
    
    X.Org Bug 38313 <http://bugs.freedesktop.org/show_bug.cgi?id=38313>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 6ea4ba0..306d0ff 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -840,10 +840,15 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
     ScreenPtr scr = miPointerGetScreen(dev);
     double x, y;
 
-    BUG_WARN(!dev->valuator);
-    BUG_WARN(dev->valuator->numAxes < 2);
+    BUG_WARN(!dev->valuator || dev->valuator->numAxes < 2);
     if (!dev->valuator || dev->valuator->numAxes < 2)
+    {
+        /* if we have no axes, last.valuators must be in screen coords
+         * anyway */
+        *devx = *screenx = dev->last.valuators[0];
+        *devy = *screeny = dev->last.valuators[1];
         return scr;
+    }
 
     if (valuator_mask_isset(mask, 0))
         x = valuator_mask_get_double(mask, 0);
@@ -1493,8 +1498,6 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
 {
     CARD32 ms = GetTimeInMillis();
     int num_events = 0, nev_tmp;
-    int h_scroll_axis = pDev->valuator->h_scroll_axis;
-    int v_scroll_axis = pDev->valuator->v_scroll_axis;
     ValuatorMask mask;
     ValuatorMask scroll;
     int i;
@@ -1519,6 +1522,14 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
     {
         double val, adj;
         int axis;
+        int h_scroll_axis = -1;
+        int v_scroll_axis = -1;
+
+        if (pDev->valuator)
+        {
+            h_scroll_axis = pDev->valuator->h_scroll_axis;
+            v_scroll_axis = pDev->valuator->v_scroll_axis;
+        }
 
         /* Up is negative on valuators, down positive */
         switch (buttons) {


More information about the Xquartz-changes mailing list