mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Workaround for apparent clang bug calculating ivar offset into NSThread object.
This commit is contained in:
parent
492fdeb968
commit
ec19a2de9a
2 changed files with 24 additions and 0 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2017-12-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* 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
|
||||
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
|
||||
assumption that the instance variable was added to address a real
|
||||
performance issue it seems better to use the runtime to access the
|
||||
instance variable.
|
||||
|
||||
2017-12-10 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
* NEWS: Regenerate NEWS file for the 0.26.0 release.
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#if !defined(_NONFRAGILE_ABI)
|
||||
#define EXPOSE_NSThread_IVARS
|
||||
#endif
|
||||
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
@ -97,7 +99,12 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
*/
|
||||
NSThread *th = GSCurrentThread();
|
||||
|
||||
# if defined(_NONFRAGILE_ABI)
|
||||
return (NSGraphicsContext*)object_getIvar(th,
|
||||
class_getInstanceVariable(object_getClass(th), "_gcontext"));
|
||||
# else
|
||||
return (NSGraphicsContext*) th->_gcontext;
|
||||
# endif
|
||||
#else
|
||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
||||
|
||||
|
@ -166,7 +173,12 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
*/
|
||||
NSThread *th = GSCurrentThread();
|
||||
|
||||
# if defined(_NONFRAGILE_ABI)
|
||||
object_setIvar(th,
|
||||
class_getInstanceVariable(object_getClass(th), "_gcontext"), context);
|
||||
# else
|
||||
ASSIGN(th->_gcontext, context);
|
||||
# endif
|
||||
#else
|
||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
||||
|
||||
|
|
Loading…
Reference in a new issue