Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6250


Ignore:
Timestamp:
Dec 5, 2009, 2:23:21 PM (14 years ago)
Author:
rgrieder
Message:

Fixed a pseudo memory leak.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/util/OutputHandler.cc

    r6105 r6250  
    174174        void outputChanged(int level)
    175175        {
    176             // Read ostringstream and store it
    177             this->output_.push_back(std::make_pair(level, this->buffer_.str()));
    178             // Clear content and flags
    179             this->buffer_.str(std::string());
     176            if (!this->buffer_.str().empty())
     177            {
     178                // Read ostringstream and store it
     179                this->output_.push_back(std::make_pair(level, this->buffer_.str()));
     180                // Clear content and flags
     181                this->buffer_.str(std::string());
     182            }
    180183            this->buffer_.clear();
    181184        }
     
    214217        this->registerOutputListener(this->consoleWriter_);
    215218
    216         this->output_  = new MemoryLogWriter();
     219        this->output_ = new MemoryLogWriter();
    217220        // We capture as much input as the listener with the highest level
    218221        this->output_->softDebugLevel_ = getSoftDebugLevel();
     
    224227    {
    225228        delete this->logFile_;
     229        delete this->consoleWriter_;
    226230        delete this->output_;
    227231    }
Note: See TracChangeset for help on using the changeset viewer.