comparison Core/Logging.cpp @ 3367:b0b5852622e4

Fixed leak in RestoreLoggingMemento
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 13 May 2019 16:15:02 +0200
parents ea07b29c6d0e
children a5e225eac0a9
comparison
equal deleted inserted replaced
3366:7a4d586caf2d 3367:b0b5852622e4
506 LoggingMementoImpl* memento = 506 LoggingMementoImpl* memento =
507 reinterpret_cast<LoggingMementoImpl*>(mementoPtr); 507 reinterpret_cast<LoggingMementoImpl*>(mementoPtr);
508 if (!memento->valid_) 508 if (!memento->valid_)
509 throw std::runtime_error("Memento already used"); 509 throw std::runtime_error("Memento already used");
510 memento->valid_ = false; 510 memento->valid_ = false;
511 std::auto_ptr<LoggingMementoImpl> deleter(memento);
511 { 512 {
512 boost::mutex::scoped_lock lock(loggingMutex_); 513 boost::mutex::scoped_lock lock(loggingMutex_);
513 loggingContext_.reset(new LoggingContext); 514 loggingContext_.reset(new LoggingContext);
514 loggingContext_->error_ = memento->error_; 515 loggingContext_->error_ = memento->error_;
515 loggingContext_->warning_ = memento->warning_; 516 loggingContext_->warning_ = memento->warning_;