Einzelnen Beitrag anzeigen

BlackSeven

Registriert seit: 25. Sep 2004
79 Beiträge
 
Delphi XE7 Professional
 
#35

AW: DSharp - Data bindings, MVVM und mehr für Delphi 2010 und höher

  Alt 6. Okt 2012, 21:56
Hallo Stefan,

folgender, unter DXE2 (Zielplatform: Win64) kompilierter Code löst eine Exception aus:
First chance exception at $0000000000686EE1. Exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'. Process Project1.exe

Delphi-Quellcode:
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
  private

    FClick: TNotifyEvent;

    function GetClick: TNotifyEvent;
    procedure SetClick(const AValue: TNotifyEvent);

  public

    property Click: TNotifyEvent read GetClick write SetClick;

  end;

var
  Form1: TForm1;

implementation

uses

  DSharp.Bindings;

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin

  TBinding.Create(Button1, 'OnClick', Self, 'Click');

end;

function TForm1.GetClick: TNotifyEvent;
begin

  Result := FClick;

end;

procedure TForm1.SetClick(const AValue: TNotifyEvent);
begin

  FClick := AValue;

end;

end.

Der Fehler tritt in der Unit "DSharp.Core.Expressions" auf:

Delphi-Quellcode:
procedure TPropertyExpression.SetValue(const Value: TValue);
var

...

begin

...

  if FIndex = -1 then
  begin
    
    if LProperty.IsWritable then
    begin
      LProperty.SetValue(LInstance.AsPointer, LValue); <--- hier
    end;

  end

...
System.Rtti.Invoke -> RawInvoke(CodeAddress, @block);
Angehängte Dateien
Dateityp: zip Test.zip (2,9 KB, 3x aufgerufen)
  Mit Zitat antworten Zitat