mORMot and Open Source friends
Check-in [215152b939]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{6332} backport TServiceFactoryServer.CreateInstance refcount from mORMot 2 - as reported on https://synopse.info/forum/viewtopic.php?id=6014
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 215152b939b9d48933c637252617b13c2e28e8f9
User & Date: ab 2021-10-06 13:42:14
Context
2021-10-07
08:56
{6333} added some missing files needed to properly re-compile SQLite3 - especially the custom regexp and cipher extensions check-in: 72ab788101 user: ab tags: trunk
2021-10-06
13:42
{6332} backport TServiceFactoryServer.CreateInstance refcount from mORMot 2 - as reported on https://synopse.info/forum/viewtopic.php?id=6014 check-in: 215152b939 user: ab tags: trunk
2021-10-05
10:23
{6331} documentation update (and regeneration) check-in: a3a977f33d user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite3/mORMot.pas.

58436
58437
58438
58439
58440
58441
58442
58443
58444
58445
58446
58447
58448
58449

58450
58451
58452
58453

58454
58455
58456
58457
58458
58459
58460
  ickFromInjectedResolver: begin
    dummyObj := nil;
    if not TSQLRestServer(Rest).Services.
       TryResolveInternal(fInterface.fInterfaceTypeInfo,dummyObj) then
      raise EInterfaceFactoryException.CreateUTF8(
        'ickFromInjectedResolver: TryResolveInternal(%)=false',[fInterface.fInterfaceName]);
    result := TInterfacedObject(ObjectFromInterface(IInterface(dummyObj)));
    if AndIncreaseRefCount then // RefCount=1 after TryResolveInternal()
      AndIncreaseRefCount := false else
      dec(TInterfacedObjectHooked(result).FRefCount);
  end;
  else
    result := fImplementationClass.Create;
  end;

  if Assigned(TSQLRestServer(Rest).OnServiceCreateInstance) then
    TSQLRestServer(Rest).OnServiceCreateInstance(self,result);
  if AndIncreaseRefCount then
    IInterface(result)._AddRef; // allow passing self to sub-methods

end;

procedure TServiceFactoryServer.OnLogRestExecuteMethod(Sender: TServiceMethodExecute;
  Step: TServiceMethodExecuteEventStep);
var W: TTextWriter;
    a, len: integer;
begin






<
<
|




>


|
<
>







58436
58437
58438
58439
58440
58441
58442


58443
58444
58445
58446
58447
58448
58449
58450
58451

58452
58453
58454
58455
58456
58457
58458
58459
  ickFromInjectedResolver: begin
    dummyObj := nil;
    if not TSQLRestServer(Rest).Services.
       TryResolveInternal(fInterface.fInterfaceTypeInfo,dummyObj) then
      raise EInterfaceFactoryException.CreateUTF8(
        'ickFromInjectedResolver: TryResolveInternal(%)=false',[fInterface.fInterfaceName]);
    result := TInterfacedObject(ObjectFromInterface(IInterface(dummyObj)));


    dec(TInterfacedObjectHooked(result).FRefCount); // RefCount=1 after TryResolveInternal()
  end;
  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 not AndIncreaseRefCount then

    dec(TInterfacedObjectHooked(result).FRefCount);
end;

procedure TServiceFactoryServer.OnLogRestExecuteMethod(Sender: TServiceMethodExecute;
  Step: TServiceMethodExecuteEventStep);
var W: TTextWriter;
    a, len: integer;
begin

Changes to SynopseCommit.inc.

1
'1.18.6331'
|
1
'1.18.6332'