diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-04-01 19:01:55 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-04-01 19:06:43 -0400 |
| commit | 672665dec001edae90fd1dcfdc94a0a54585c4bf (patch) | |
| tree | 8a3a2a79d8a850a536c2259267853658e90c6f46 /Source/Core | |
| parent | bf8ffe5bfb50ce1d2aa969ea6cc1901dc79a85ec (diff) | |
AsyncRequests: In-class initialize class members
Prior to this change, it's possible for m_wake_me_up_again to be used
while it's in an uninitialized state from the exposed API.
e.g.
- Using SetEnable after construction would perform an uninitialized read.
- Using PushEvent would perform an uninitialized read by way of operator |=.
internally, an uninitialized read can happen if PullEventsInternal() is
executed before other functions.
Just to avoid the whole possibility of performing uninitialized reads,
we just give the class member a default value of false.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/VideoCommon/AsyncRequests.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/AsyncRequests.h | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/AsyncRequests.cpp b/Source/Core/VideoCommon/AsyncRequests.cpp index f41354730d..cab79c8bc2 100644 --- a/Source/Core/VideoCommon/AsyncRequests.cpp +++ b/Source/Core/VideoCommon/AsyncRequests.cpp @@ -12,9 +12,7 @@ AsyncRequests AsyncRequests::s_singleton; -AsyncRequests::AsyncRequests() : m_enable(false), m_passthrough(true) -{ -} +AsyncRequests::AsyncRequests() = default; void AsyncRequests::PullEventsInternal() { diff --git a/Source/Core/VideoCommon/AsyncRequests.h b/Source/Core/VideoCommon/AsyncRequests.h index c898c86c62..4c22d388e3 100644 --- a/Source/Core/VideoCommon/AsyncRequests.h +++ b/Source/Core/VideoCommon/AsyncRequests.h @@ -90,9 +90,9 @@ private: std::mutex m_mutex; std::condition_variable m_cond; - bool m_wake_me_up_again; - bool m_enable; - bool m_passthrough; + bool m_wake_me_up_again = false; + bool m_enable = false; + bool m_passthrough = true; std::vector<EfbPokeData> m_merged_efb_pokes; }; |
