diff options
author | Rubidium <rubidium@openttd.org> | 2021-05-12 19:44:00 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-13 10:03:26 +0200 |
commit | 7755f81bb8ba1c6a47e3a528acbbc462e56adaff (patch) | |
tree | aff19b5894e3a5546e43f610ca6a3c0a9e154c8d /src/window.cpp | |
parent | d7ce61f10674567c97a1edd78ea1baf4e08153f2 (diff) | |
download | openttd-7755f81bb8ba1c6a47e3a528acbbc462e56adaff.tar.xz |
Codechange: make explicit that virtual functions in a con/destructor are resolved statically
This as during construction the sub class has not been initialized yet, and
during destruction the sub class has already been destroyed, so the overriding
virtual function would be accessing uninitialized data.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp index af4721445..bb7787581 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1094,7 +1094,8 @@ Window::~Window() /* Make sure we don't try to access this window as the focused window when it doesn't exist anymore. */ if (_focused_window == this) { - this->OnFocusLost(); + /* Virtual functions get called statically in destructors, so make it explicit to remove any confusion. */ + this->Window::OnFocusLost(); _focused_window = nullptr; } |