Protected +initialize from being called multiple times on GSContext because of

subclasses. 

As a result, this eliminates a gstate table memory leak, and prevents the table 
to be reset while still in use (causing various DPS errors such as invalid 
param, stack underflow and segfault).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@35153 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
qmathe 2012-05-14 15:02:00 +00:00
parent 3ba33eb1b1
commit 3b74a4c14b
2 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,13 @@
2012-05-14 Quentin Mathe <quentin.mathe@gmail.com>
* Source/gsc/GSContext.m (+initialize): Protected +initialize from being
called multiple times because of subclasses. As a result, this
eliminates a gtable memory leak (e.g. +initialize sent to both GSContext
and CairoContext at backend initialization time), and prevents the
gstate stack to be reset while still in use (e.g. the program enumerates
classes at runtime and sends messages to them... +initialize might be
sent to GSStreamContext in such a case).
2012-05-12 Eric Wasylishen <ewasylishen@gmail.com>
* Source/x11/XIMInputServer.m: Remove the locale setting code.

View file

@ -135,8 +135,11 @@ static NSMapTable *gtable;
+ (void) initialize
{
gtable = NSCreateMapTable(NSIntMapKeyCallBacks,
NSObjectMapValueCallBacks, 20);
if (self == [GSContext class])
{
gtable = NSCreateMapTable(NSIntMapKeyCallBacks,
NSObjectMapValueCallBacks, 20);
}
}
+ (void) insertObject: (id)obj forKey: (int)index