#1 2012-04-15 21:11:36

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

Assertion failure in SQLite3Commons

I got this assertion failure error in SQLite3Commons

destructor TServiceFactoryClient.Destroy;
begin
  if fSharedInstance<>nil then begin
    Assert(TInterfacedObjectFake(fSharedInstance).fRefCount=1);                             // gives assertion error
    TInterfacedObjectFake(fSharedInstance)._Release; // bonne nuit les petits
  end;
  if fFakeStub<>nil then
    VirtualFree(fFakeStub,0,MEM_RELEASE);
  inherited;
end;

how can i avoid this?

Offline

#2 2012-04-16 04:29:20

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

Re: Assertion failure in SQLite3Commons

On the client side of the code, the used interface is not freed.

Release the interface on the client side in your code BEFORE calling Client.Free:

  MyClient.Services.Info(TypeInfo(IMyService)).Get(MyService);
  ...
  // use MyService
  ...
  MyService := nil; // shall be done BEFORE release client
  MyClient.Free;

This is an issue in your implementation pattern.
See what the latest version of the documentation says about this, and http://synopse.info/forum/viewtopic.php?pid=3849#p3849

I've changed the assertion into an Exception.
See  http://synopse.info/fossil/info/c56be3152c
You need to correct your code, to avoid any other possible trouble.

Offline

#3 2012-04-16 21:13:00

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

Re: Assertion failure in SQLite3Commons

I changed my code.
Now it runs OK.

thank you

Offline

Board footer

Powered by FluxBB