audacia/src/AudacityLogger.h
Paul Licameli bf5228267a Calls to Disconnect or Unbind in destructors are not needed, if...
... it's either the source of the connection that is being destroyed, or other
object (such as an ancestor window) transitively owning it and so causing it to
be destroyed too;

or, the sink is being destroyed, and that sink is a wxEvtHandler (which is
always so for Disconnect, though not for Unbind in case Bind was passed a
member function of a non-wxEvtHandler).

wxWidgets takes care of erasing the connection in such cases.

This removes most calls to Disconnect and Unbind.  Many destructors shrank to
nothing.

Notably, in case of popup menu handling, the call to Disconnect is not removable
because the object being destroyed is neither the source nor the sink.
2018-02-21 19:28:06 -05:00

55 lines
1.1 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
AudacityLogger.h
Dominic Mazzoni
This is the main source file for Audacity which handles
initialization and termination by subclassing wxApp.
**********************************************************************/
#ifndef __AUDACITY_LOGGER__
#define __AUDACITY_LOGGER__
#include "Audacity.h"
#include "MemoryX.h"
#include <wx/event.h>
#include <wx/log.h>
#include <wx/frame.h>
#include <wx/textctrl.h>
#include <wx/string.h>
#include "Experimental.h"
class AudacityLogger final : public wxEvtHandler, public wxLog {
public:
AudacityLogger();
void Show(bool show = true);
#if defined(EXPERIMENTAL_CRASH_REPORT)
wxString GetLog();
#endif
protected:
void Flush() override;
void DoLogText(const wxString & msg) override;
private:
void OnCloseWindow(wxCloseEvent & e);
void OnClose(wxCommandEvent & e);
void OnClear(wxCommandEvent & e);
void OnSave(wxCommandEvent & e);
Destroy_ptr<wxFrame> mFrame;
wxTextCtrl *mText;
wxString mBuffer;
bool mUpdated;
};
#endif