[Libreoffice-commits] core.git: forms/source framework/source include/osl

Thorsten Behrens thb at libreoffice.org
Tue Apr 9 23:11:43 UTC 2019


Hi Mike,

Mike Kaganski (via logerrit) wrote:
>     [API CHANGE] Asserts to never clear already cleared guard
>
>     ... which could help catch copy-paste errors when wrong guard is cleared
>     second time.
>
The assert() is quite nice, but:

> --- a/include/osl/mutex.hxx
> +++ b/include/osl/mutex.hxx
> @@ -178,11 +178,9 @@ namespace osl
>          */
>          void clear()
>          {
> -            if(pT)
> -            {
> -                pT->release();
> -                pT = NULL;
> -            }
> +            assert(pT);
> +            pT->release();
> +            pT = NULL;
>          }
>      };
>
This will have unsuspecting consumers of our API crash if they don't
catch the assertion during development. I'm not sure that's a positive
thing to impose on our ecosystem (where LibreOffice support might
already not be a priority).

I'd be much happier with the pT check still present, but guarded by
!LIBO_INTERNAL_ONLY.

Cheers,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1032 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20190410/d2337a38/attachment.sig>


More information about the LibreOffice mailing list