From 80b6768536fa439bfc5ce948bc8845a6f4af857b Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Thu, 23 Oct 2008 17:32:32 -0700 Subject: [PATCH] XQuartz: Do check_xinitrc() later to avoid possible deadlock. (cherry picked from commit af95174a088dc787d124ec548b1005f5b67c9e8d) --- hw/xquartz/X11Application.m | 29 ++++++++++-------- .../English.lproj/Localizable.strings | Bin 2416 -> 2528 bytes 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index ff202e339..5da1ffcc2 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -788,20 +788,19 @@ static void check_xinitrc (void) { Windows displayed by X11 applications may not have titlebars, or may look \ different to windows displayed by native applications.\n\n\ Would you like to move aside the existing file and use the standard X11 \ -environment?", @"Startup xinitrc dialog"); - - if (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""), - NSLocalizedString (@"No", @""), nil) - == NSAlertDefaultReturn) { - char buf2[1024]; - int i = -1; +environment the next time you start X11?", @"Startup xinitrc dialog"); + + if(NSAlertDefaultReturn == NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""), + NSLocalizedString (@"No", @""), nil)) { + char buf2[1024]; + int i = -1; - snprintf (buf2, sizeof (buf2), "%s.old", buf); + snprintf (buf2, sizeof (buf2), "%s.old", buf); - for (i = 1; access (buf2, F_OK) == 0; i++) - snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i); - - rename (buf, buf2); + for(i = 1; access (buf2, F_OK) == 0; i++) + snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i); + + rename (buf, buf2); } done: @@ -824,7 +823,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { [[NSNotificationCenter defaultCenter] addObserver:NSApp selector:@selector (became_key:) name:NSWindowDidBecomeKeyNotification object:nil]; - check_xinitrc (); /* * The xpr Quartz mode is statically linked into this server. @@ -850,6 +848,11 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { /* Tell the server thread that it can proceed */ QuartzInitServer(argc, argv, envp); + + /* This must be done after QuartzInitServer because it can result in + * an mieqEnqueue() - + */ + check_xinitrc(); [NSApp run]; /* not reached */ diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings index fec942ebf88d458a6a4844a4d59c98e903485718..001227afe839e8e760f78d6c12fcaf93384d969a 100644 GIT binary patch delta 121 zcmew$^gwvSO*V4{h7yJhhExUxhCGH;h6;uf29QW5LoQgXk|Cd=ltF=^n4yFrk)a4I a8^K`6V7U1P8!wYCNt!1fke>XNqZ$Bf;TswN delta 16 XcmaDL{6T2LO}5Q~>^w}9Lpi$vIz$E9