* Source/GSDisplayServer.m: Store the current display server in a

static variable and not in a thread variable.
Idea by Yavor Doganov  <yavor@gnu.org>
This commit is contained in:
fredkiefer 2018-02-09 21:31:03 +01:00
parent caa58cf72b
commit 41e02a5ed5
2 changed files with 9 additions and 9 deletions

View file

@ -1,3 +1,9 @@
2018-02-09 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSDisplayServer.m: Store the current display server in a
static variable and not in a thread variable.
Idea by Yavor Doganov <yavor@gnu.org>
2018-02-05 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Make

View file

@ -33,7 +33,6 @@
#import <Foundation/NSLock.h>
#import <Foundation/NSRunLoop.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSThread.h>
#import <Foundation/NSGeometry.h>
#import "AppKit/NSApplication.h"
@ -64,6 +63,7 @@ static NSMapTable *windowmaps = NULL;
static NSRecursiveLock *serverLock = nil;
static NSString *NSCurrentServerThreadKey;
static GSDisplayServer *currentServer = nil;
/** Returns the GSDisplayServer that created the interal
representation for window. If the internal representation has not
@ -93,9 +93,7 @@ GSServerForWindow(NSWindow *window)
GSDisplayServer *
GSCurrentServer(void)
{
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
return (GSDisplayServer*) [dict objectForKey: NSCurrentServerThreadKey];
return currentServer;
}
/**
@ -199,11 +197,7 @@ GSCurrentServer(void)
*/
+ (void) setCurrentServer: (GSDisplayServer *)server
{
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
if (server)
[dict setObject: server forKey: NSCurrentServerThreadKey];
else
[dict removeObjectForKey: NSCurrentServerThreadKey];
ASSIGN(currentServer, server);
}
/** <init />