From d3077c3b8b2c89c413c2cf5d50a34999ef100dbc Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Sun, 25 Jul 2010 17:33:44 +0000 Subject: [PATCH] Change emit_stdout to a private member variable, this was changed in r4575. Putting it on the stack won't work since it'll just unsubscribe which we don't want. Unfortunatly this is wrapped with _DEBUG everywhere in main.(h|cpp) if we need more debugging code in the future I'll figure out a better solution. Originally committed to SVN as r4712. --- aegisub/src/main.cpp | 7 +++++-- aegisub/src/main.h | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index f08b032d5..50cb1dfd2 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -144,8 +144,8 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { /// bool AegisubApp::OnInit() { #ifdef _DEBUG - agi::log::EmitSTDOUT emit_stdout; - emit_stdout.Enable(); + emit_stdout = new agi::log::EmitSTDOUT(); + emit_stdout->Enable(); #endif // App name (yeah, this is a little weird to get rid of an odd warning) @@ -285,6 +285,9 @@ int AegisubApp::OnExit() { delete config::mru; #ifdef WITH_AUTOMATION delete global_scripts; +#endif +#ifdef _DEBUG + delete emit_stdout; #endif return wxApp::OnExit(); } diff --git a/aegisub/src/main.h b/aegisub/src/main.h index 4e96c0d8f..f9d14ee16 100644 --- a/aegisub/src/main.h +++ b/aegisub/src/main.h @@ -51,6 +51,13 @@ // Prototypes class FrameMain; class PluginManager; +#ifdef _DEBUG +namespace agi { + namespace log { + class EmitSTDOUT; + } +} +#endif /// For holding all configuration-related objects and values. namespace config { @@ -81,6 +88,11 @@ private: void OnMouseWheel(wxMouseEvent &event); void OnKey(wxKeyEvent &key); +#ifdef _DEBUG + /// stdout log emitter + agi::log::EmitSTDOUT *emit_stdout; +#endif + public: /// DOCME