From 98cb85df66bb915aeb910a09838e1677cfeaf71a Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 15 Feb 2019 15:24:58 +0400 Subject: [PATCH] Polymorphic classes without virtual dtor warning. --- .../SourceFiles/media/player/media_player_float.h | 2 ++ Telegram/SourceFiles/platform/win/audio_win.cpp | 3 ++- Telegram/SourceFiles/platform/win/launcher_win.cpp | 2 +- .../SourceFiles/platform/win/main_window_win.cpp | 4 ++-- .../SourceFiles/platform/win/main_window_win.h | 2 +- .../platform/win/notifications_manager_win.cpp | 7 +++---- Telegram/SourceFiles/platform/win/specific_win.cpp | 8 ++------ Telegram/SourceFiles/platform/win/specific_win.h | 2 +- .../platform/win/windows_app_user_model_id.cpp | 4 ++-- .../platform/win/windows_app_user_model_id.h | 2 +- Telegram/SourceFiles/platform/win/windows_dlls.h | 2 +- .../platform/win/windows_event_filter.h | 2 +- .../{windows_h_wrapper.h => wrapper_windows_h.h} | 0 .../platform/win/wrapper_wrl_implements_h.h | 14 ++++++++++++++ .../storage/storage_clear_legacy_win.cpp | 2 +- .../SourceFiles/storage/storage_file_lock_win.cpp | 2 +- Telegram/SourceFiles/ui/rp_widget.h | 2 ++ Telegram/SourceFiles/ui/style/style_core.h | 3 +++ Telegram/gyp/settings_win.gypi | 1 + Telegram/gyp/telegram_sources.txt | 2 ++ 20 files changed, 43 insertions(+), 23 deletions(-) rename Telegram/SourceFiles/platform/win/{windows_h_wrapper.h => wrapper_windows_h.h} (100%) create mode 100644 Telegram/SourceFiles/platform/win/wrapper_wrl_implements_h.h diff --git a/Telegram/SourceFiles/media/player/media_player_float.h b/Telegram/SourceFiles/media/player/media_player_float.h index 67973caf98..f845e96858 100644 --- a/Telegram/SourceFiles/media/player/media_player_float.h +++ b/Telegram/SourceFiles/media/player/media_player_float.h @@ -132,6 +132,8 @@ public: return _filterWheelEvent.events(); } + virtual ~FloatDelegate() = default; + protected: void floatPlayerCheckVisibility() { _checkVisibility.fire({}); diff --git a/Telegram/SourceFiles/platform/win/audio_win.cpp b/Telegram/SourceFiles/platform/win/audio_win.cpp index 9207d54860..db62394a3e 100644 --- a/Telegram/SourceFiles/platform/win/audio_win.cpp +++ b/Telegram/SourceFiles/platform/win/audio_win.cpp @@ -13,7 +13,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include -#include +#include + using namespace Microsoft::WRL; namespace Platform { diff --git a/Telegram/SourceFiles/platform/win/launcher_win.cpp b/Telegram/SourceFiles/platform/win/launcher_win.cpp index 8a1c34efea..dac5c205e3 100644 --- a/Telegram/SourceFiles/platform/win/launcher_win.cpp +++ b/Telegram/SourceFiles/platform/win/launcher_win.cpp @@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/crash_reports.h" #include "core/update_checker.h" #include "platform/platform_specific.h" -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" #include diff --git a/Telegram/SourceFiles/platform/win/main_window_win.cpp b/Telegram/SourceFiles/platform/win/main_window_win.cpp index af1f0e9eae..36d19357e2 100644 --- a/Telegram/SourceFiles/platform/win/main_window_win.cpp +++ b/Telegram/SourceFiles/platform/win/main_window_win.cpp @@ -26,8 +26,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include -#include -#include +#include +#include "platform/win/wrapper_wrl_implements_h.h" #include #include diff --git a/Telegram/SourceFiles/platform/win/main_window_win.h b/Telegram/SourceFiles/platform/win/main_window_win.h index 159330aeae..9482d12c5b 100644 --- a/Telegram/SourceFiles/platform/win/main_window_win.h +++ b/Telegram/SourceFiles/platform/win/main_window_win.h @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once #include "platform/platform_main_window.h" -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" #include "base/flags.h" namespace Ui { diff --git a/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp b/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp index 8935eee484..14e88d93d8 100644 --- a/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp +++ b/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp @@ -18,8 +18,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include -#include -#include +#include +#include "platform/win/wrapper_wrl_implements_h.h" #include #include @@ -196,7 +196,7 @@ typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastDismissedEventHandler; typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastFailedEventHandler; -class ToastEventHandler : public Implements< +class ToastEventHandler final : public Implements< DesktopToastActivatedEventHandler, DesktopToastDismissedEventHandler, DesktopToastFailedEventHandler> { @@ -210,7 +210,6 @@ public: , _msgId(msg) , _weak(guarded) { } - ~ToastEventHandler() = default; void performOnMainQueue(FnMut task) { const auto weak = _weak; diff --git a/Telegram/SourceFiles/platform/win/specific_win.cpp b/Telegram/SourceFiles/platform/win/specific_win.cpp index 6c619c71c1..1946b60ecb 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.cpp +++ b/Telegram/SourceFiles/platform/win/specific_win.cpp @@ -23,16 +23,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include -#include -#include +#include +#include "platform/win/wrapper_wrl_implements_h.h" #include -#pragma warning(push) -#pragma warning(disable:4091) #include #include -#pragma warning(pop) - #include #include #include diff --git a/Telegram/SourceFiles/platform/win/specific_win.h b/Telegram/SourceFiles/platform/win/specific_win.h index a2308f650d..1e96b0a411 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.h +++ b/Telegram/SourceFiles/platform/win/specific_win.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" class LocationCoords; diff --git a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp index 11db71f0ab..a162dfce81 100644 --- a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp +++ b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp @@ -12,8 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include -#include -#include +#include +#include "platform/win/wrapper_wrl_implements_h.h" #include using namespace Microsoft::WRL; diff --git a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.h b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.h index 9a2c6d11b7..a2a1952a1a 100644 --- a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.h +++ b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" namespace Platform { namespace AppUserModelId { diff --git a/Telegram/SourceFiles/platform/win/windows_dlls.h b/Telegram/SourceFiles/platform/win/windows_dlls.h index a78be5004a..2d72bf7423 100644 --- a/Telegram/SourceFiles/platform/win/windows_dlls.h +++ b/Telegram/SourceFiles/platform/win/windows_dlls.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" #include #include diff --git a/Telegram/SourceFiles/platform/win/windows_event_filter.h b/Telegram/SourceFiles/platform/win/windows_event_filter.h index c54154309a..062f1f3910 100644 --- a/Telegram/SourceFiles/platform/win/windows_event_filter.h +++ b/Telegram/SourceFiles/platform/win/windows_event_filter.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" namespace Platform { diff --git a/Telegram/SourceFiles/platform/win/windows_h_wrapper.h b/Telegram/SourceFiles/platform/win/wrapper_windows_h.h similarity index 100% rename from Telegram/SourceFiles/platform/win/windows_h_wrapper.h rename to Telegram/SourceFiles/platform/win/wrapper_windows_h.h diff --git a/Telegram/SourceFiles/platform/win/wrapper_wrl_implements_h.h b/Telegram/SourceFiles/platform/win/wrapper_wrl_implements_h.h new file mode 100644 index 0000000000..4f7ccd7f7d --- /dev/null +++ b/Telegram/SourceFiles/platform/win/wrapper_wrl_implements_h.h @@ -0,0 +1,14 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#pragma warning(push) +// class has virtual functions, but destructor is not virtual +#pragma warning(disable:4265) +#include +#pragma warning(pop) diff --git a/Telegram/SourceFiles/storage/storage_clear_legacy_win.cpp b/Telegram/SourceFiles/storage/storage_clear_legacy_win.cpp index 2579127ed1..c353339b75 100644 --- a/Telegram/SourceFiles/storage/storage_clear_legacy_win.cpp +++ b/Telegram/SourceFiles/storage/storage_clear_legacy_win.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "storage/storage_clear_legacy.h" -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" namespace Storage { namespace details { diff --git a/Telegram/SourceFiles/storage/storage_file_lock_win.cpp b/Telegram/SourceFiles/storage/storage_file_lock_win.cpp index a589966ca9..f4957af690 100644 --- a/Telegram/SourceFiles/storage/storage_file_lock_win.cpp +++ b/Telegram/SourceFiles/storage/storage_file_lock_win.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_file_lock.h" #include "platform/win/windows_dlls.h" -#include "platform/win/windows_h_wrapper.h" +#include "platform/win/wrapper_windows_h.h" #include #include diff --git a/Telegram/SourceFiles/ui/rp_widget.h b/Telegram/SourceFiles/ui/rp_widget.h index eb2ed5a09a..16d50f369d 100644 --- a/Telegram/SourceFiles/ui/rp_widget.h +++ b/Telegram/SourceFiles/ui/rp_widget.h @@ -124,6 +124,8 @@ public: rpl::lifetime &lifetime(); + virtual ~RpWidgetMethods() = default; + protected: bool handleEvent(QEvent *event); virtual bool eventHook(QEvent *event) = 0; diff --git a/Telegram/SourceFiles/ui/style/style_core.h b/Telegram/SourceFiles/ui/style/style_core.h index d64eb89523..0e0e6cc592 100644 --- a/Telegram/SourceFiles/ui/style/style_core.h +++ b/Telegram/SourceFiles/ui/style/style_core.h @@ -43,6 +43,9 @@ class ModuleBase { public: virtual void start() = 0; virtual void stop() = 0; + + virtual ~ModuleBase() = default; + }; void registerModule(ModuleBase *module); diff --git a/Telegram/gyp/settings_win.gypi b/Telegram/gyp/settings_win.gypi index dff01287d3..b852d75274 100644 --- a/Telegram/gyp/settings_win.gypi +++ b/Telegram/gyp/settings_win.gypi @@ -31,6 +31,7 @@ '/EHsc', # Catch C++ exceptions only, extern C functions never throw a C++ exception. '/w14834', # [[nodiscard]] '/w15038', # wrong initialization order + '/w14265', # class has virtual functions, but destructor is not virtual ], 'TreatWChar_tAsBuiltInType': 'false', }, diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt index 0198e10a70..390c685a94 100644 --- a/Telegram/gyp/telegram_sources.txt +++ b/Telegram/gyp/telegram_sources.txt @@ -580,6 +580,8 @@ <(src_loc)/platform/win/windows_dlls.h <(src_loc)/platform/win/windows_event_filter.cpp <(src_loc)/platform/win/windows_event_filter.h +<(src_loc)/platform/win/wrapper_windows_h.h +<(src_loc)/platform/win/wrapper_wrl_implements_h.h <(src_loc)/platform/platform_audio.h <(src_loc)/platform/platform_file_utilities.h <(src_loc)/platform/platform_launcher.h