cocoa: Fixes crash, bug #27561

git-svn-id: trunk@48040 -
This commit is contained in:
sekelsenmat 2015-02-28 11:26:09 +00:00
parent e30dfa934a
commit a99c9eaabd
2 changed files with 8 additions and 5 deletions

View File

@ -1693,21 +1693,23 @@ end;
function TCocoaWidgetSet.GetDC(hWnd: HWND): HDC;
var
ctx: TCocoaContext;
ctx: TCocoaContext = nil;
lCallback: ICommonCallback;
begin
if hWnd = 0 then
Result := HDC(ScreenContext)
else
begin
ctx := NSObject(hWnd).lclGetCallback.GetContext;
lCallback := NSObject(hWnd).lclGetCallback;
if lCallback <> nil then
ctx := lCallback.GetContext;
if ctx = nil then
begin
ctx := TCocoaContext.Create(DefaultContext.ctx);
with DefaultContext.size do
ctx.InitDraw(cx, cy);
ctx.InitDraw(DefaultContext.size.cx, DefaultContext.size.cy);
end;
Result := HDC(ctx)
Result := HDC(ctx);
end;
{$IFDEF VerboseWinAPI}

View File

@ -174,6 +174,7 @@ function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo
function SetSysColors(cElements: Integer; const lpaElements; const lpaRgbValues): Boolean; override;
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
function SetViewPortOrgEx(DC: HDC; NewX, NewY: Integer; OldPoint: PPoint): Boolean; override;
//function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : PtrInt): PtrInt; override;
function SetWindowOrgEx(DC: HDC; NewX, NewY: Integer; OldPoint: PPoint) : Boolean; override;
function ShowCaret(Handle: HWND): Boolean; override;
function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; override;