Remove uses of temporary RAII objects

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.5.4
    • Affects Version/s: None
    • Component/s: Concurrency
    • None
    • Fully Compatible
    • ALL
    • Storage 2017-03-06
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      A common RAII idiom for locking is as follows:

      {
          stdx::lock_guard<Client> lk(*txn->getClient());
          // Do stuff while holding the lock
      }
      

      However, as the name of the object (lk) isn't referenced, this is very easily mistyped as:

      {
          stdx::lock_guard<Client> (*txn->getClient());
          // Do stuff while surprisingly NOT holding the lock!!!
      }
      

      So, check for any occurrences of temporaries with constructors and instead use named variables.

              Assignee:
              Geert Bosch
              Reporter:
              Geert Bosch
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: