Skip to content

Commit 287628d

Browse files
committed
Deal with Embarcadero#6
__owned__ is now Read-Write property
1 parent a966dd7 commit 287628d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Source/WrapDelphi.pas

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ TPyDelphiObject = class (TPyInterfacedObject, IFreeNotificationSubscriber)
538538
// Exposed Getters
539539
function Get_ClassName(Acontext : Pointer) : PPyObject; cdecl;
540540
function Get_Owned(Acontext : Pointer) : PPyObject; cdecl;
541+
function Set_Owned(AValue: PPyObject; AContext: Pointer): Integer;
541542
function Get_Bound(Acontext : Pointer) : PPyObject; cdecl;
542543
// implementation of interface IFreeNotificationSubscriber
543544
procedure Notify(ADeletedObject : TObject);
@@ -2496,7 +2497,7 @@ class procedure TPyDelphiObject.RegisterGetSets(PythonType: TPythonType);
24962497
'Returns the TObject.ClassName', nil);
24972498
AddGetSet('__bound__', @TPyDelphiObject.Get_Bound, nil,
24982499
'Returns True if the wrapper is still bound to the Delphi instance.', nil);
2499-
AddGetSet('__owned__', @TPyDelphiObject.Get_Owned, nil,
2500+
AddGetSet('__owned__', @TPyDelphiObject.Get_Owned, @TPyDelphiObject.Set_Owned,
25002501
'Returns True if the wrapper owns the Delphi instance.', nil);
25012502
end;
25022503
end;
@@ -2743,6 +2744,21 @@ class procedure TPyDelphiObject.SetupType(PythonType: TPythonType);
27432744
end;
27442745
end;
27452746

2747+
function TPyDelphiObject.Set_Owned(AValue: PPyObject;
2748+
AContext: Pointer): Integer;
2749+
var
2750+
_value : Boolean;
2751+
begin
2752+
Adjust(@Self);
2753+
if CheckBoolAttribute(AValue, '__owned__', _value) then
2754+
begin
2755+
Owned := _value;
2756+
Result := 0;
2757+
end
2758+
else
2759+
Result := -1;
2760+
end;
2761+
27462762
function TPyDelphiObject.SqAssItem(idx: NativeInt; obj: PPyObject): integer;
27472763
begin
27482764
if HasContainerAccessClass then

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy