mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 23:49:36 +02:00
cocoa: commit accSone patch which moves default gdi object creation/destruction to widgetset constructor/destructor. This makes them live inside autorelease pool. (issue #0025321)
git-svn-id: trunk@43457 -
This commit is contained in:
parent
222560f8b8
commit
e700e2df51
@ -1132,6 +1132,7 @@ begin
|
||||
begin
|
||||
FBitmap := AValue;
|
||||
ctx := NSGraphicsContext.graphicsContextWithBitmapImageRep(Bitmap.ImageRep);
|
||||
ctx.retain; // extend live beyond NSAutoreleasePool
|
||||
InitDraw(Bitmap.Width, Bitmap.Height);
|
||||
end;
|
||||
end;
|
||||
@ -2624,22 +2625,9 @@ begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
DefaultBrush := TCocoaBrush.CreateDefault;
|
||||
DefaultPen := TCocoaPen.CreateDefault;
|
||||
DefaultFont := TCocoaFont.CreateDefault;
|
||||
DefaultBitmap := TCocoaBitmap.CreateDefault;
|
||||
DefaultContext := TCocoaBitmapContext.Create;
|
||||
DefaultContext.Bitmap := DefaultBitmap;
|
||||
|
||||
ScreenContext := TCocoaContext.Create(DefaultContext.ctx);
|
||||
|
||||
finalization
|
||||
ScreenContext.Free;
|
||||
DefaultContext.Free;
|
||||
|
||||
DefaultBrush.Free;
|
||||
DefaultPen.Free;
|
||||
DefaultFont.Free;
|
||||
DefaultBitmap.Free;
|
||||
|
||||
end.
|
||||
|
@ -96,6 +96,15 @@ begin
|
||||
NSMessageLParam := NSStringUTF8('LPARAM');
|
||||
NSMessageResult := NSStringUTF8('RESULT');
|
||||
|
||||
DefaultBrush := TCocoaBrush.CreateDefault;
|
||||
DefaultPen := TCocoaPen.CreateDefault;
|
||||
DefaultFont := TCocoaFont.CreateDefault;
|
||||
DefaultBitmap := TCocoaBitmap.CreateDefault;
|
||||
DefaultContext := TCocoaBitmapContext.Create;
|
||||
DefaultContext.Bitmap := DefaultBitmap;
|
||||
|
||||
ScreenContext := TCocoaContext.Create(DefaultContext.ctx);
|
||||
|
||||
InitStockItems;
|
||||
end;
|
||||
|
||||
@ -108,6 +117,14 @@ destructor TCocoaWidgetSet.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
|
||||
ScreenContext.Free;
|
||||
DefaultContext.Free;
|
||||
|
||||
DefaultBrush.Free;
|
||||
DefaultPen.Free;
|
||||
DefaultFont.Free;
|
||||
DefaultBitmap.Free;
|
||||
|
||||
FreeSysColorBrushes;
|
||||
FreeStockItems;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user