From a491cb1360d4a3e79a96378d20b01e0d53bf1379 Mon Sep 17 00:00:00 2001 From: joost Date: Sat, 25 Jan 2014 10:50:10 +0000 Subject: [PATCH] * The handle of a TCustomForm contains in most cases a TCocoaWindowContent and not directly a NSWindow. This fixes an access violation git-svn-id: trunk@43791 - --- lcl/interfaces/cocoa/cocoawsforms.pp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoawsforms.pp b/lcl/interfaces/cocoa/cocoawsforms.pp index 6d67d2f612..2158d415bf 100644 --- a/lcl/interfaces/cocoa/cocoawsforms.pp +++ b/lcl/interfaces/cocoa/cocoawsforms.pp @@ -382,8 +382,13 @@ begin cnt.callback := TCocoaWindow(win).callback; win.setContentView(cnt); - if AParams.WndParent <> 0 then - NSWindow(AParams.WndParent).addChildWindow_ordered(win, NSWindowAbove); + if (AParams.WndParent <> 0) then + begin + if (NSObject(AParams.WndParent).isKindOfClass(TCocoaWindowContent)) and (not TCocoaWindowContent(AParams.WndParent).isembedded) then + TCocoaWindowContent(AParams.WndParent).window.addChildWindow_ordered(win, NSWindowAbove) + else + NSWindow(AParams.WndParent).addChildWindow_ordered(win, NSWindowAbove); + end; end else begin