From 0cfd3b94db89f4fc6b5755d61060a684aa9ff7d6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 17 Apr 2020 19:57:48 -0400 Subject: [PATCH 1/3] service/time: Add virtual destructors where applicable Many of these implementations are used to implement a polymorphic interface. While not directly used polymorphically, this prevents virtual destruction from ever becoming an issue. --- src/core/hle/service/time/steady_clock_core.h | 1 + .../hle/service/time/system_clock_context_update_callback.h | 2 +- src/core/hle/service/time/system_clock_core.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/time/steady_clock_core.h b/src/core/hle/service/time/steady_clock_core.h index 84af3d1051..d80a2385f6 100644 --- a/src/core/hle/service/time/steady_clock_core.h +++ b/src/core/hle/service/time/steady_clock_core.h @@ -16,6 +16,7 @@ namespace Service::Time::Clock { class SteadyClockCore { public: SteadyClockCore() = default; + virtual ~SteadyClockCore() = default; const Common::UUID& GetClockSourceId() const { return clock_source_id; diff --git a/src/core/hle/service/time/system_clock_context_update_callback.h b/src/core/hle/service/time/system_clock_context_update_callback.h index 6260de6c30..2b0fa7e75e 100644 --- a/src/core/hle/service/time/system_clock_context_update_callback.h +++ b/src/core/hle/service/time/system_clock_context_update_callback.h @@ -20,7 +20,7 @@ namespace Service::Time::Clock { class SystemClockContextUpdateCallback { public: SystemClockContextUpdateCallback(); - ~SystemClockContextUpdateCallback(); + virtual ~SystemClockContextUpdateCallback(); bool NeedUpdate(const SystemClockContext& value) const; diff --git a/src/core/hle/service/time/system_clock_core.h b/src/core/hle/service/time/system_clock_core.h index 54407a6c52..608dd3b2ea 100644 --- a/src/core/hle/service/time/system_clock_core.h +++ b/src/core/hle/service/time/system_clock_core.h @@ -22,7 +22,7 @@ class SystemClockContextUpdateCallback; class SystemClockCore { public: explicit SystemClockCore(SteadyClockCore& steady_clock_core); - ~SystemClockCore(); + virtual ~SystemClockCore(); SteadyClockCore& GetSteadyClockCore() const { return steady_clock_core; From b533f18ab965506c372f182d4d4ede6a5ffb0f51 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 17 Apr 2020 20:02:42 -0400 Subject: [PATCH 2/3] service/time: Mark IsStandardNetworkSystemClockAccuracySufficient as const This doesn't modify internal member state. --- src/core/hle/service/time/standard_network_system_clock_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/time/standard_network_system_clock_core.h b/src/core/hle/service/time/standard_network_system_clock_core.h index 3f505c37c0..c993bdf79c 100644 --- a/src/core/hle/service/time/standard_network_system_clock_core.h +++ b/src/core/hle/service/time/standard_network_system_clock_core.h @@ -23,7 +23,7 @@ public: standard_network_clock_sufficient_accuracy = value; } - bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) { + bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const { SystemClockContext context{}; if (GetClockContext(system, context) != RESULT_SUCCESS) { return {}; From 7714b02d95f3f70efc3a5148f18f4b5a22855f16 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 17 Apr 2020 20:04:04 -0400 Subject: [PATCH 3/3] time/system_clock_core: Remove unnecessary initializer This is already initialized within the class body. --- src/core/hle/service/time/system_clock_core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/time/system_clock_core.cpp b/src/core/hle/service/time/system_clock_core.cpp index 1a3ab8cfa6..d31d4e2ca0 100644 --- a/src/core/hle/service/time/system_clock_core.cpp +++ b/src/core/hle/service/time/system_clock_core.cpp @@ -9,7 +9,7 @@ namespace Service::Time::Clock { SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core) - : steady_clock_core{steady_clock_core}, is_initialized{} { + : steady_clock_core{steady_clock_core} { context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId(); }