* Source/NSGraphicsContext.m (+graphicsContextWithGraphicsPort:flipped:):

Rewrite using an init method.
This commit is contained in:
fredkiefer 2018-09-14 22:18:16 +02:00
parent 397a4116cc
commit b90d3a341e
3 changed files with 26 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2018-09-14 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSGraphicsContext.m
(+graphicsContextWithGraphicsPort:flipped:): Rewrite using an init method.
2018-08-05 <wolfgang.lux@gmail.com>
* Source/NSApplication.m (-setApplicationIconImage:): Avoid
@ -224,7 +229,7 @@
* Source/NSGraphicsContext.m: When using clang and the gnustep
runtime (the nonfragile API), it seems the compiler calculates the
offset of the _gcontext instance variuable in the NSThread object
offset of the _gcontext instance variable in the NSThread object
incorrectly, causing a crash.
Until we know why and can fix it, we need a workaround. The simplest
one would be not to use the instance variable at all, but on the

View file

@ -248,6 +248,8 @@ APPKIT_EXPORT NSGraphicsContext *GSCurrentContext(void);
+ (void) setDefaultContextClass: (Class)defaultContextClass;
- (id) initWithContextInfo: (NSDictionary*)info;
- (id) initWithGraphicsPort: (void *)port
flipped: (BOOL)flag;
/*
* Focus management methods - lock and unlock should only be used by NSView

View file

@ -234,14 +234,12 @@ NSGraphicsContext *GSCurrentContext(void)
+ (NSGraphicsContext *) graphicsContextWithGraphicsPort: (void *)port
flipped: (BOOL)flag
{
NSGraphicsContext *new;
NSGraphicsContext *ctxt;
// FIXME
new = [self graphicsContextWithAttributes: nil];
new->_graphicsPort = port;
new->_isFlipped = flag;
return new;
ctxt = [[self alloc] initWithGraphicsPort: port
flipped: flag];
return AUTORELEASE(ctxt);
}
+ (NSGraphicsContext *)graphicsContextWithCGContext: (CGContextRef)context
@ -359,6 +357,19 @@ NSGraphicsContext *GSCurrentContext(void)
return self;
}
- (id) initWithGraphicsPort: (void *)port
flipped: (BOOL)flag;
{
self = [self init];
if (self != nil)
{
_graphicsPort = port;
_isFlipped = flag;
}
return self;
}
- (NSDictionary *) attributes
{
return context_info;