Date: prev next · Thread: first prev next last
2019 Archives by date, by thread · List index


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

Attachment: signature.asc
Description: PGP signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.