#1 2018-07-26 18:09:18

jaclas
Member
Registered: 2014-09-12
Posts: 215

Potential bug?

Enter/Leave critical section without try..finally.

In mORMot.pas, procedure ComputeResult:

    if ForceServiceResultAsXMLObjectNameSpace='' then
      ForceServiceResultAsXMLObjectNameSpace := Service.ResultAsXMLObjectNameSpace;
    with Server.fStats do begin
      EnterCriticalSection(fLock);  <-- is there no lack of try finally?
      inc(fServiceInterface);
      Changed;
      LeaveCriticalSection(fLock); <--
    end;

Offline

#2 2018-07-26 18:49:49

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

Re: Potential bug?

This was on purpose since we trusted the code in Changed, and wanted to have the smallest impact possible on performance here.

But a small try..finally could be safer here, you are right.
See https://synopse.info/fossil/info/d9c2eb9672

Offline

Board footer

Powered by FluxBB