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() {
#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();
}

View File

@ -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