Fix some "leaks" of things that should actually be alive for the lifetime of the program to reduce noise.

Originally committed to SVN as r4574.
This commit is contained in:
Thomas Goyne 2010-06-24 01:24:02 +00:00
parent 50d1b3ed2d
commit cbf201ab86
4 changed files with 11 additions and 12 deletions

View file

@ -18,10 +18,13 @@
/// @brief Logging /// @brief Logging
/// @ingroup libaegisub /// @ingroup libaegisub
#ifndef AGI_PRE
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <memory>
#endif
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/mutex.h" #include "libaegisub/mutex.h"
#include "libaegisub/types.h" #include "libaegisub/types.h"
@ -31,7 +34,7 @@ namespace agi {
namespace log { namespace log {
/// Global log sink. /// Global log sink.
LogSink *log = new LogSink(); std::auto_ptr<LogSink> log(new LogSink());
/// Short Severity ID /// Short Severity ID
/// Keep this ordered the same as Severity /// Keep this ordered the same as Severity

View file

@ -67,7 +67,7 @@ enum Severity {
extern const char *Severity_ID; extern const char *Severity_ID;
/// Global log sink. /// Global log sink.
extern LogSink *log; extern std::auto_ptr<LogSink> log;
/// Container to hold a single message /// Container to hold a single message
struct SinkMessage { struct SinkMessage {

View file

@ -34,9 +34,6 @@
/// @ingroup export /// @ingroup export
/// ///
///////////
// Headers
#include "config.h" #include "config.h"
#include "ass_export_filter.h" #include "ass_export_filter.h"
@ -184,7 +181,7 @@ const wxString& AssExportFilter::GetDescription() const {
/// DOCME /// DOCME
AssExportFilterChain *AssExportFilterChain::instance=NULL; std::auto_ptr<AssExportFilterChain> AssExportFilterChain::instance;
@ -192,7 +189,7 @@ AssExportFilterChain *AssExportFilterChain::instance=NULL;
/// @return /// @return
/// ///
FilterList *AssExportFilterChain::GetFilterList() { FilterList *AssExportFilterChain::GetFilterList() {
if (instance == NULL) instance = new AssExportFilterChain(); if (!instance.get()) instance.reset(new AssExportFilterChain());
return &(instance->Filters); return &(instance->Filters);
} }
@ -202,7 +199,7 @@ FilterList *AssExportFilterChain::GetFilterList() {
/// @return /// @return
/// ///
FilterList *AssExportFilterChain::GetUnpreparedFilterList() { FilterList *AssExportFilterChain::GetUnpreparedFilterList() {
if (instance == NULL) instance = new AssExportFilterChain(); if (!instance.get()) instance.reset(new AssExportFilterChain());
return &(instance->Unprepared); return &(instance->Unprepared);
} }
@ -216,5 +213,3 @@ void AssExportFilterChain::PrepareFilters() {
} }
instance->Unprepared.clear(); instance->Unprepared.clear();
} }

View file

@ -42,6 +42,7 @@
// Headers // Headers
#ifndef AGI_PRE #ifndef AGI_PRE
#include <list> #include <list>
#include <memory>
#include <wx/string.h> #include <wx/string.h>
#include <wx/window.h> #include <wx/window.h>
@ -81,7 +82,7 @@ private:
/// DOCME /// DOCME
static AssExportFilterChain *instance; static std::auto_ptr<AssExportFilterChain> instance;
static FilterList *GetFilterList(); static FilterList *GetFilterList();
static FilterList *GetUnpreparedFilterList(); static FilterList *GetUnpreparedFilterList();