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.
This commit is contained in:
Amar Takhar 2010-07-25 17:33:44 +00:00
parent 79a67ae1ec
commit d3077c3b8b
2 changed files with 17 additions and 2 deletions

View file

@ -144,8 +144,8 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) {
/// ///
bool AegisubApp::OnInit() { bool AegisubApp::OnInit() {
#ifdef _DEBUG #ifdef _DEBUG
agi::log::EmitSTDOUT emit_stdout; emit_stdout = new agi::log::EmitSTDOUT();
emit_stdout.Enable(); emit_stdout->Enable();
#endif #endif
// App name (yeah, this is a little weird to get rid of an odd warning) // 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; delete config::mru;
#ifdef WITH_AUTOMATION #ifdef WITH_AUTOMATION
delete global_scripts; delete global_scripts;
#endif
#ifdef _DEBUG
delete emit_stdout;
#endif #endif
return wxApp::OnExit(); return wxApp::OnExit();
} }

View file

@ -51,6 +51,13 @@
// Prototypes // Prototypes
class FrameMain; class FrameMain;
class PluginManager; class PluginManager;
#ifdef _DEBUG
namespace agi {
namespace log {
class EmitSTDOUT;
}
}
#endif
/// For holding all configuration-related objects and values. /// For holding all configuration-related objects and values.
namespace config { namespace config {
@ -81,6 +88,11 @@ private:
void OnMouseWheel(wxMouseEvent &event); void OnMouseWheel(wxMouseEvent &event);
void OnKey(wxKeyEvent &key); void OnKey(wxKeyEvent &key);
#ifdef _DEBUG
/// stdout log emitter
agi::log::EmitSTDOUT *emit_stdout;
#endif
public: public:
/// DOCME /// DOCME