#1 2021-10-06 11:28:59

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

BUGFix for mORMot.pas

Hi Arnaud. i tried to upload this patch to github. But my credentials are rejected

diff --git a/SQLite3/mORMot.pas b/SQLite3/mORMot.pas
index 5b692f78..30d00b67 100644
--- a/SQLite3/mORMot.pas
+++ b/SQLite3/mORMot.pas
@@ -58447,10 +58447,11 @@ begin
   else
     result := fImplementationClass.Create;
   end;
+  inc(TInterfacedObjectHooked(result).FRefCount); // >0 to call Support() in event
   if Assigned(TSQLRestServer(Rest).OnServiceCreateInstance) then
     TSQLRestServer(Rest).OnServiceCreateInstance(self,result);
-  if AndIncreaseRefCount then
-    IInterface(result)._AddRef; // allow passing self to sub-methods
+  if not AndIncreaseRefCount then
+    dec(TInterfacedObjectHooked(result).FRefCount);
 end;
 
 procedure TServiceFactoryServer.OnLogRestExecuteMethod(Sender: TServiceMethodExecute;

Rad Studio 12.1 Santorini

Offline

#2 2021-10-06 12:42:37

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 218
Website

Re: BUGFix for mORMot.pas

Hi,

you need your own github account, clone the repo to your account, upload the changes to yours and then start a pull-request. This way, a review before merge is possible.

Regards,
Daniel

Offline

#3 2021-10-06 13:42:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: BUGFix for mORMot.pas

I have seen you backported TServiceFactoryServer.CreateInstance refcount logic from mORMot 2.
wink

I have pushed the modification.
See https://synopse.info/fossil/info/215152b939

Offline

#4 2021-10-06 15:39:48

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: BUGFix for mORMot.pas

thank you - yes i used a piece of code with mORMot2 and then with mORMot and under mORMot my Objekt was freed in Support...


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB