1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 09:01:15 +02:00

Rewrite more Connect() with Bind(), which were type incorrect...

... though harmlessly so.  They called to nonstatic member functions of classes
with improper this pointers; though the functions did not use this.

Bind events to nonmember funtions instead.  Sometimes just to empty lambdas to
consume the event and ignore it, blocking other handlers.
This commit is contained in:
Paul Licameli
2018-02-12 17:27:51 -05:00
parent 2f3604bdea
commit e6e8e3251c
9 changed files with 54 additions and 57 deletions

View File

@@ -167,13 +167,15 @@ public:
public:
void ConnectEvent(wxWindow *w)
{
w->GetEventHandler()->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(FocusHandler::OnKillFocus));
// Need to use a named function pointer, not a lambda, so that we
// can unbind the same later
w->GetEventHandler()->Bind(wxEVT_KILL_FOCUS, OnKillFocus);
};
void DisconnectEvent(wxWindow *w)
{
w->GetEventHandler()->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(FocusHandler::OnKillFocus));
w->GetEventHandler()->Unbind(wxEVT_KILL_FOCUS, OnKillFocus);
};
void OnKillFocus(wxFocusEvent & WXUNUSED(event))
static void OnKillFocus(wxFocusEvent & WXUNUSED(event))
{
return;
};