* Fixed sigint by closing/re-opening resource

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2855 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
loesje_ 2013-12-01 16:37:25 +00:00
parent 94144e9e61
commit 6aa1ad039d
2 changed files with 21 additions and 3 deletions

View File

@ -124,7 +124,9 @@ const
type
IMyWidgetDesigner = interface(IUnknown)
['{AB6C118F-9520-626A-ED24-378E04D03474}']
procedure InvalidateRect(Sender: TObject; ARect: TRect; Erase: boolean);
procedure ClearMyForm;
function CreateComponent(ParentComp: TComponent;
TypeClass: TComponentClass;
const AUnitName: shortstring;
@ -1942,6 +1944,8 @@ end;
destructor NSObject.Destroy;
begin
inherited Destroy;
if assigned(Designer) then
Designer.ClearMyForm;
FNIBDocument.Free;
end;

View File

@ -56,6 +56,12 @@ type
TNSObjectDesignerMediator = class(TDesignerMediator,IMyWidgetDesigner)
private
FMyForm: NSObject;
protected
// This method is available through IMyWidgetDesigner and is used to
// clear the MyForm variable when the form is destroyed. This is necessary
// because it could be that this mediator is destroyed somewhat later,
// which could lead into problems.
procedure ClearMyForm;
public
function UseRTTIForMethods(aComponent: TComponent): boolean; override;
// needed by the lazarus form editor
@ -366,9 +372,12 @@ var
Mediator: TNSObjectDesignerMediator;
begin
Result:=inherited CreateMediator(TheOwner,aForm);
Mediator:=TNSObjectDesignerMediator(Result);
Mediator.FMyForm:=aForm as NSObject;
Mediator.FMyForm.Designer:=Mediator;
Mediator:=Result as TNSObjectDesignerMediator;
if assigned(result) and assigned(aForm) and (aForm is NSObject) then
begin
Mediator.FMyForm:=aForm as NSObject;
Mediator.FMyForm.Designer:=Mediator as IMyWidgetDesigner;
end;
end;
class function TNSObjectDesignerMediator.FormClass: TComponentClass;
@ -393,6 +402,11 @@ begin
LCLIntf.InvalidateRect(LCLForm.Handle,@ARect,Erase);
end;
procedure TNSObjectDesignerMediator.ClearMyForm;
begin
FMyForm := nil;
end;
procedure TNSObjectDesignerMediator.SetBounds(AComponent: TComponent; NewBounds: TRect);
begin
if AComponent is tiOSFakeComponent then begin