- NSBundle memory leak fix

- NSObject memory leak fix (LookupAndCache assumes cache has been checked)
- spin lock fix
- plist writing accepts NSNumbers
- KVO doesn't call out for setObservationInfo:
- TTFFont cache
- CairoContext etc. deallocs
- various X11 fixes
This commit is contained in:
Johannes Fortmann 2009-01-02 12:04:01 +00:00
parent d5b3b202c1
commit a1ace363cb
15 changed files with 268 additions and 33 deletions

View File

@ -20,6 +20,11 @@
return self;
}
-(void)dealloc {
cairo_surface_destroy(_surface);
[super dealloc];
}
-(float)width
{
return _size.width;

View File

@ -14,10 +14,13 @@
#import <AppKit/X11Window.h>
@interface CairoContext : KGContext {
NSRect _dirtyRect;
cairo_surface_t *_surface;
cairo_t *_context;
}
-(id)initWithWindow:(X11Window*)w;
-(void)setSize:(NSSize)size;
-(NSSize)size;
-(NSRect)dirtyRect;
-(void)resetDirtyRect;
@end

View File

@ -69,6 +69,7 @@
default:
;
}
_dirtyRect=NSMakeRect(0, 0, size.width, size.height);
_context = cairo_create(_surface);
}
@ -244,46 +245,55 @@
-(void)drawPath:(CGPathDrawingMode)mode
{
[self setCurrentPath:(KGPath*)_path];
switch(mode)
{
case kCGPathStroke:
[self setCurrentColor:[self strokeColor]];
[self synchronizeLineAttributes];
cairo_stroke(_context);
cairo_stroke_preserve(_context);
break;
case kCGPathFill:
[self setCurrentColor:[self fillColor]];
cairo_set_fill_rule(_context, CAIRO_FILL_RULE_WINDING);
cairo_fill(_context);
cairo_fill_preserve(_context);
break;
case kCGPathEOFill:
[self setCurrentColor:[self fillColor]];
cairo_set_fill_rule(_context, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill(_context);
cairo_fill_preserve(_context);
break;
case kCGPathFillStroke:
[self setCurrentColor:[self fillColor]];
cairo_set_fill_rule(_context, CAIRO_FILL_RULE_WINDING);
cairo_fill(_context);
cairo_fill_preserve(_context);
[self setCurrentColor:[self strokeColor]];
[self synchronizeLineAttributes];
cairo_stroke(_context);
cairo_stroke_preserve(_context);
break;
case kCGPathEOFillStroke:
[self setCurrentColor:[self fillColor]];
cairo_set_fill_rule(_context, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill(_context);
cairo_fill_preserve(_context);
[self setCurrentColor:[self strokeColor]];
[self synchronizeLineAttributes];
cairo_stroke(_context);
cairo_stroke_preserve(_context);
break;
}
{
double x,y,x2,y2;
cairo_stroke_extents(_context, &x, &y, &x2, &y2);
_dirtyRect=NSUnionRect(_dirtyRect, NSMakeRect(x, y, x2-x, y2-y));
}
cairo_new_path(_context);
[_path reset];
}
@ -353,7 +363,13 @@
cairo_set_source_surface(_context, img, 0.0, 0.0);
cairo_paint(_context);
cairo_paint(_context);
{
double x,y,x2,y2;
cairo_clip_extents(_context, &x, &y, &x2, &y2);
_dirtyRect=NSUnionRect(_dirtyRect, NSMakeRect(x, y, x2-x, y2-y));
}
if(shouldFreeImage)
cairo_surface_destroy(img);
@ -391,6 +407,17 @@
cairo_show_glyphs(_context, cg, count);
{
/*double x,y,x2,y2;
CGAffineTransform ctm=[[self currentState] textMatrix];
cairo_glyph_path(_context, cg, count);
cairo_stroke_extents(_context, &x, &y, &x2, &y2);
NSRect rect=NSMakeRect(x, y, x2-x, y2-y);
rect=NSOffsetRect(rect, ctm.tx, ctm.ty);
_dirtyRect=NSUnionRect(_dirtyRect, rect);*/
}
cairo_font_face_destroy(face);
}
@ -415,12 +442,34 @@
return _surface;
}
-(void)drawContext:(CairoContext*)other
-(NSRect)dirtyRect; {
return _dirtyRect;
}
-(void)resetDirtyRect; {
_dirtyRect=NSZeroRect;
}
-(void)copyFromBackingContext:(CairoContext*)other
{
cairo_identity_matrix(_context);
cairo_reset_clip(_context);
NSRect clip=[other dirtyRect];
CGAffineTransform matrix={1, 0, 0, -1, 0, [self size].height};
clip.origin=CGAffineTransformTransformVector2(matrix, clip.origin);
clip.origin.y-=clip.size.height;
cairo_new_path(_context);
cairo_set_source_rgba(_context, 1.0, 0.0, 0.0, 0.5);
cairo_rectangle(_context, clip.origin.x, clip.origin.y, clip.size.width, clip.size.height);
cairo_clip(_context);
cairo_set_source_surface (_context, [other _cairoSurface], 0, 0);
cairo_paint(_context);
[other resetDirtyRect];
}
-(void)establishFontStateInDevice {

View File

@ -8,6 +8,7 @@
#import "TTFFont.h"
#import <AppKit/KTFont.h>
#import <AppKit/KGFont.h>
@implementation KTFont(TTFFont)
+(id)allocWithZone:(NSZone*)zone
@ -50,9 +51,22 @@ FT_Library library;
}
-initWithFont:(KGFont *)font size:(float)size {
NSString* key=[NSString stringWithFormat:@"%@@%f", [font fontName], size];
static NSMutableDictionary *cache=nil;
if(!cache)
cache=[NSMutableDictionary new];
id ret=[cache objectForKey:key];
if(ret) {
[self release];
return [ret retain];
}
[cache setObject:self forKey:key];
if(self=[super init])
{
FT_Error ret=FT_New_Face(library,
"/Library/Fonts/Tahoma.ttf",
0,
@ -69,6 +83,12 @@ FT_Library library;
return self;
}
-(void)dealloc {
FT_Done_Face(_face);
[_name release];
[super dealloc];
}
-initWithUIFontType:(CTFontUIFontType)uiFontType size:(CGFloat)size language:(NSString *)language {
KGFont *font=nil;
@ -85,7 +105,7 @@ FT_Library library;
NSUnimplementedMethod();
return nil;
}
self=[self initWithFont:font size:size];
[font release];
@ -123,8 +143,6 @@ FT_Library library;
FT_Load_Glyph(_face, current, FT_LOAD_DEFAULT);
return NSMakePoint(_face->glyph->advance.x/(float)(2<<5),
_face->glyph->advance.y/(float)(2<<5));
}
-(FT_Face)face

View File

@ -184,7 +184,7 @@
-(void)handleEvent:(NSData*)data {
XEvent e;
[data getBytes:&e length:sizeof(XEvent)];
NSLog(@"event handler");
switch(e.type) {
case DestroyNotify:
{
@ -258,13 +258,13 @@
case KeyPress:
{
id window=[self windowForID:e.xkey.window];
char buf[128]={0};
XLookupString(&e, buf, 128, NULL, NULL);
char buf[4]={0};
XLookupString(&e, buf, 4, NULL, NULL);
id str=[[NSString alloc] initWithCString:buf encoding:NSISOLatin1StringEncoding];
NSPoint pos=[window transformPoint:NSMakePoint(e.xbutton.x, e.xbutton.y)];
e.xkey.state=0;
XLookupString(&e, buf, 128, NULL, NULL);
XLookupString(&e, buf, 4, NULL, NULL);
id strIg=[[NSString alloc] initWithCString:buf encoding:NSISOLatin1StringEncoding];
id ev=[NSEvent keyEventWithType:NSKeyDown
@ -294,11 +294,14 @@
-(void)processX11Event {
XEvent e;
while(XPending(_display)) {
XNextEvent(_display, &e);
[self handleEvent:[NSData dataWithBytes:&e
length:sizeof(XEvent)]];
int i;
int numEvents;
while(numEvents=XEventsQueued(_display, QueuedAfterReading)) {
for(i=0; i<numEvents; i++) {
XNextEvent(_display, &e);
[self handleEvent:[NSData dataWithBytes:&e
length:sizeof(XEvent)]];
}
}
}

View File

@ -35,7 +35,7 @@
}
-(void)selectInputSource:(NSSelectInputSource *)inputSource selectEvent:(unsigned)selectEvent; {
if(XPending([_display display])) {
if(XEventsQueued([_display display], QueuedAfterReading)) {
[_display processX11Event];
}
}

View File

@ -51,6 +51,14 @@
return self;
}
-(void)dealloc {
[self invalidate];
[_backingContext release];
[_cgContext release];
[_deviceDictionary release];
[super dealloc];
}
-(void)removeDecoration
{
struct {
@ -194,7 +202,8 @@
-(void)flushBuffer {
[_cgContext drawContext:_backingContext];
[_cgContext copyFromBackingContext:_backingContext];
}

View File

@ -28,6 +28,29 @@
C88977300EA0C0CD00D0A0A2 /* CGImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = FE45EDC20DC2400F00F49290 /* CGImageSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
C88977310EA0C0CD00D0A0A2 /* CGPDFDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7ABE630DC2C0290060D15B /* CGPDFDocument.h */; settings = {ATTRIBUTES = (Public, ); }; };
C88977320EA0C0CD00D0A0A2 /* CGImageProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = FE66EFFA0E513A3B006C5796 /* CGImageProperties.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2730F07E9B70054397C /* ApplicationServices.h in Headers */ = {isa = PBXBuildFile; fileRef = FE32179C0BB41C65004F000A /* ApplicationServices.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2740F07E9B70054397C /* CGAffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4DA0DB7110900BA2A8E /* CGAffineTransform.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2750F07E9B70054397C /* CGBitmapContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4DB0DB7110900BA2A8E /* CGBitmapContext.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2760F07E9B70054397C /* CGColor.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4DC0DB7110900BA2A8E /* CGColor.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2770F07E9B70054397C /* CGColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4DD0DB7110900BA2A8E /* CGColorSpace.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2780F07E9B70054397C /* CGContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4DE0DB7110900BA2A8E /* CGContext.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2790F07E9B70054397C /* CGDataProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4DF0DB7110900BA2A8E /* CGDataProvider.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E27A0F07E9B70054397C /* CGFont.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E00DB7110900BA2A8E /* CGFont.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E27B0F07E9B70054397C /* CGFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E10DB7110900BA2A8E /* CGFunction.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E27C0F07E9B70054397C /* CGGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E20DB7110900BA2A8E /* CGGeometry.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E27D0F07E9B70054397C /* CGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E30DB7110900BA2A8E /* CGImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E27E0F07E9B70054397C /* CGLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E40DB7110900BA2A8E /* CGLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E27F0F07E9B70054397C /* CGPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E50DB7110900BA2A8E /* CGPath.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2800F07E9B70054397C /* CGPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E60DB7110900BA2A8E /* CGPattern.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2810F07E9B70054397C /* CGShading.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E70DB7110900BA2A8E /* CGShading.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2820F07E9B70054397C /* CoreGraphics.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF4E80DB7110900BA2A8E /* CoreGraphics.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2830F07E9B70054397C /* CoreGraphicsExport.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF5150DB711BC00BA2A8E /* CoreGraphicsExport.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2840F07E9B70054397C /* CGPDFPage.h in Headers */ = {isa = PBXBuildFile; fileRef = FECAF52D0DB7134F00BA2A8E /* CGPDFPage.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2850F07E9B70054397C /* CGImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = FE45EDC20DC2400F00F49290 /* CGImageSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2860F07E9B70054397C /* CGPDFDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7ABE630DC2C0290060D15B /* CGPDFDocument.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2870F07E9B70054397C /* CGImageProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = FE66EFFA0E513A3B006C5796 /* CGImageProperties.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2880F07E9B70054397C /* CTFont.h in Headers */ = {isa = PBXBuildFile; fileRef = FE337F860EE772FB00D4A751 /* CTFont.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8A2E2890F07E9B70054397C /* CoreText.h in Headers */ = {isa = PBXBuildFile; fileRef = FE337FB50EE7799F00D4A751 /* CoreText.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE01AAE60C5D9BF900AEA51A /* ApplicationServices.h in Headers */ = {isa = PBXBuildFile; fileRef = FE32179C0BB41C65004F000A /* ApplicationServices.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE337F870EE772FB00D4A751 /* CTFont.h in Headers */ = {isa = PBXBuildFile; fileRef = FE337F860EE772FB00D4A751 /* CTFont.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE337F880EE772FB00D4A751 /* CTFont.h in Headers */ = {isa = PBXBuildFile; fileRef = FE337F860EE772FB00D4A751 /* CTFont.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -64,6 +87,14 @@
outputFiles = (
);
};
C8A2E28D0F07E9B70054397C /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = org.cocotron.1.0.linux.i386.gcc.default;
fileType = sourcecode.c;
isEditable = 1;
outputFiles = (
);
};
FE01AAEA0C5D9BF900AEA51A /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = org.cocotron.1.0.windows.i386.gcc.default;
@ -117,6 +148,7 @@
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
C88977390EA0C0CD00D0A0A2 /* ApplicationServices.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApplicationServices.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C8A2E2900F07E9B70054397C /* ApplicationServices.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApplicationServices.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FE01AAED0C5D9BF900AEA51A /* ApplicationServices.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApplicationServices.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FE32179C0BB41C65004F000A /* ApplicationServices.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ApplicationServices.h; sourceTree = "<group>"; };
FE337F860EE772FB00D4A751 /* CTFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTFont.h; sourceTree = "<group>"; };
@ -152,6 +184,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C8A2E28C0F07E9B70054397C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
FE01AAE90C5D9BF900AEA51A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -167,6 +206,7 @@
children = (
FE01AAED0C5D9BF900AEA51A /* ApplicationServices.framework */,
C88977390EA0C0CD00D0A0A2 /* ApplicationServices.framework */,
C8A2E2900F07E9B70054397C /* ApplicationServices.framework */,
);
name = Products;
sourceTree = "<group>";
@ -291,6 +331,36 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C8A2E2720F07E9B70054397C /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
C8A2E2730F07E9B70054397C /* ApplicationServices.h in Headers */,
C8A2E2740F07E9B70054397C /* CGAffineTransform.h in Headers */,
C8A2E2750F07E9B70054397C /* CGBitmapContext.h in Headers */,
C8A2E2760F07E9B70054397C /* CGColor.h in Headers */,
C8A2E2770F07E9B70054397C /* CGColorSpace.h in Headers */,
C8A2E2780F07E9B70054397C /* CGContext.h in Headers */,
C8A2E2790F07E9B70054397C /* CGDataProvider.h in Headers */,
C8A2E27A0F07E9B70054397C /* CGFont.h in Headers */,
C8A2E27B0F07E9B70054397C /* CGFunction.h in Headers */,
C8A2E27C0F07E9B70054397C /* CGGeometry.h in Headers */,
C8A2E27D0F07E9B70054397C /* CGImage.h in Headers */,
C8A2E27E0F07E9B70054397C /* CGLayer.h in Headers */,
C8A2E27F0F07E9B70054397C /* CGPath.h in Headers */,
C8A2E2800F07E9B70054397C /* CGPattern.h in Headers */,
C8A2E2810F07E9B70054397C /* CGShading.h in Headers */,
C8A2E2820F07E9B70054397C /* CoreGraphics.h in Headers */,
C8A2E2830F07E9B70054397C /* CoreGraphicsExport.h in Headers */,
C8A2E2840F07E9B70054397C /* CGPDFPage.h in Headers */,
C8A2E2850F07E9B70054397C /* CGImageSource.h in Headers */,
C8A2E2860F07E9B70054397C /* CGPDFDocument.h in Headers */,
C8A2E2870F07E9B70054397C /* CGImageProperties.h in Headers */,
C8A2E2880F07E9B70054397C /* CTFont.h in Headers */,
C8A2E2890F07E9B70054397C /* CoreText.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FE01AAE50C5D9BF900AEA51A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
@ -344,6 +414,26 @@
productReference = C88977390EA0C0CD00D0A0A2 /* ApplicationServices.framework */;
productType = "com.apple.product-type.framework";
};
C8A2E2710F07E9B70054397C /* ApplicationServices-Darwin-i386 */ = {
isa = PBXNativeTarget;
buildConfigurationList = C8A2E28E0F07E9B70054397C /* Build configuration list for PBXNativeTarget "ApplicationServices-Darwin-i386" */;
buildPhases = (
C8A2E2720F07E9B70054397C /* Headers */,
C8A2E28A0F07E9B70054397C /* Resources */,
C8A2E28B0F07E9B70054397C /* Sources */,
C8A2E28C0F07E9B70054397C /* Frameworks */,
);
buildRules = (
C8A2E28D0F07E9B70054397C /* PBXBuildRule */,
);
dependencies = (
);
name = "ApplicationServices-Darwin-i386";
productInstallPath = "$(HOME)/Library/Frameworks";
productName = ApplicationServices;
productReference = C8A2E2900F07E9B70054397C /* ApplicationServices.framework */;
productType = "com.apple.product-type.framework";
};
FE01AAE20C5D9BF900AEA51A /* ApplicationServices-Windows-i386 */ = {
isa = PBXNativeTarget;
buildConfigurationList = FE01AAEB0C5D9BF900AEA51A /* Build configuration list for PBXNativeTarget "ApplicationServices-Windows-i386" */;
@ -385,6 +475,7 @@
targets = (
FE01AAE20C5D9BF900AEA51A /* ApplicationServices-Windows-i386 */,
C889771C0EA0C0CD00D0A0A2 /* ApplicationServices-Linux-i386 */,
C8A2E2710F07E9B70054397C /* ApplicationServices-Darwin-i386 */,
);
};
/* End PBXProject section */
@ -435,6 +526,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C8A2E28A0F07E9B70054397C /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
FE01AAE70C5D9BF900AEA51A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@ -452,6 +550,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C8A2E28B0F07E9B70054397C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
FE01AAE80C5D9BF900AEA51A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -478,7 +583,7 @@
ARCHS = i386;
DEPLOYMENT_LOCATION = YES;
DSTROOT = /;
EXECUTABLE_SUFFIX = .1.0.dll;
EXECUTABLE_SUFFIX = .so;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
@ -495,6 +600,28 @@
};
name = Release;
};
C8A2E28F0F07E9B70054397C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = i386;
DEPLOYMENT_LOCATION = YES;
DSTROOT = /;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = /Users/jobi/Projekte/cocotron/ApplicationServices/Info.plist;
INSTALL_PATH = /Developer/Cocotron/1.0/Darwin/i386/Frameworks;
OTHER_CFLAGS = (
"-DAPPLICATIONSERVICES_INSIDE_BUILD",
"-D__LITTLE_ENDIAN__",
);
OTHER_LDFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = ApplicationServices;
SYMROOT = /Developer/Cocotron/1.0/build/ApplicationServices/Darwin/i386;
};
name = Release;
};
FE01AAEC0C5D9BF900AEA51A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -542,6 +669,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C8A2E28E0F07E9B70054397C /* Build configuration list for PBXNativeTarget "ApplicationServices-Darwin-i386" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C8A2E28F0F07E9B70054397C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FE01AAEB0C5D9BF900AEA51A /* Build configuration list for PBXNativeTarget "ApplicationServices-Windows-i386" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -179,10 +179,11 @@ static NSMapTable *pathToObject=NULL;
}
_path=[path retain];
_resourcePath=[[_path stringByAppendingPathComponent:@"Resources"] retain];
_resourcePath=[_path stringByAppendingPathComponent:@"Resources"];
if(![[NSFileManager defaultManager] fileExistsAtPath:_resourcePath])
_resourcePath=[[[_path stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"Resources"] retain];
_resourcePath=[[_path stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"Resources"];
[_resourcePath retain];
_infoDictionary=nil;
_isLoaded=NO;

View File

@ -921,6 +921,10 @@ CHANGE_DECLARATION(SEL)
+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key;
{
if([key isEqualToString:@"observationInfo"]) {
return NO;
}
return YES;
}
@end

View File

@ -76,11 +76,11 @@ extern NSMethodSignature *NSMethodSignatureWithTypes(const char *types);
+(IMP)methodForSelector:(SEL)selector {
return OBJCLookupAndCacheUniqueIdInClass(OBJCMetaClassFromClass(self),selector);
return class_getMethodImplementation(OBJCMetaClassFromClass(self),selector);
}
+(IMP)instanceMethodForSelector:(SEL)selector {
return OBJCLookupAndCacheUniqueIdInClass(self,selector);
return class_getMethodImplementation(self,selector);
}
+(NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)selector {
@ -172,7 +172,7 @@ extern NSMethodSignature *NSMethodSignatureWithTypes(const char *types);
}
-(IMP)methodForSelector:(SEL)selector {
return OBJCLookupAndCacheUniqueIdInClass(isa,selector);
return class_getMethodImplementation(isa,selector);
}
-(void)doesNotRecognizeSelector:(SEL)selector {

View File

@ -143,7 +143,7 @@ YES,YES,YES,YES,YES,YES,YES,YES,YES,YES,YES, NO, NO, NO, NO, NO,// 112
id key=[allKeys objectAtIndex:i];
[self encodeIndent:indent];
[self encodeString:key escape:YES];
[self encodeString:[key description] escape:YES];
[_data appendBytes:" = " length:3];
[self encodePropertyList:[dictionary objectForKey:key] indent:indent+1];
[_data appendBytes:";\n" length:2];

View File

@ -25,7 +25,7 @@ BOOL OSSpinLockTry( volatile OSSpinLock *__lock )
void OSSpinLockLock( volatile OSSpinLock *__lock )
{
while(__sync_bool_compare_and_swap(__lock, 0, 1))
while(!__sync_bool_compare_and_swap(__lock, 0, 1))
{
#ifdef WIN32
Sleep(0);

View File

@ -455,6 +455,13 @@ const char *class_getName(Class cls)
return cls->name;
}
IMP class_getMethodImplementation(Class cls, SEL name) {
struct objc_method *ret=OBJCLookupUniqueIdInClass(cls, name);
if(ret)
return ret->method_imp;
return NULL;
}
void OBJCLogMsg(id object,SEL message){
#if 1
if(object==nil)

View File

@ -114,6 +114,7 @@ typedef struct objc_class {
} OBJCClassTemplate;
OBJC_EXPORT Ivar class_getInstanceVariable(Class class,const char *variableName);
OBJC_EXPORT IMP class_getMethodImplementation(Class cls, SEL name);
OBJC_EXPORT void class_addMethods(Class class,struct objc_method_list *methodList);
OBJC_EXPORT Method class_getClassMethod(Class class, SEL sel);
OBJC_EXPORT Method class_getInstanceMethod(Class class, SEL sel);