1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 22:12:58 +02:00

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.
This commit is contained in:
Paul Licameli
2018-01-31 10:08:42 -05:00
parent 12983e1685
commit bf5228267a
29 changed files with 4 additions and 284 deletions

View File

@@ -133,14 +133,6 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
Center();
}
LyricsWindow::~LyricsWindow()
{
mProject->Disconnect(EVT_TRACK_PANEL_TIMER,
wxCommandEventHandler(LyricsWindow::OnTimer),
NULL,
this);
}
void LyricsWindow::OnCloseWindow(wxCloseEvent & WXUNUSED(event))
{
this->Hide();