LibVideo: Initialize primitive member variables in PlaybackManager

Using uninitialized primitives is undefined behavior. In this case, all
videos would autoplay on Serenity, but not play at all on Lagom, due to
some m_playing booleans being uninitialized.
This commit is contained in:
Timothy Flynn 2023-04-09 09:39:48 -04:00 committed by Linus Groh
parent 560133a0c6
commit 0f2b863c01
Notes: sideshowbarker 2024-07-17 08:43:11 +09:00
2 changed files with 3 additions and 3 deletions

View File

@ -314,7 +314,7 @@ protected:
return {};
}
bool m_playing;
bool m_playing { false };
};
class PlaybackManager::StartingStateHandler : public PlaybackManager::ResumingStateHandler {
@ -362,7 +362,7 @@ class PlaybackManager::StartingStateHandler : public PlaybackManager::ResumingSt
return {};
}
bool m_playing;
bool m_playing { false };
};
class PlaybackManager::PlayingStateHandler : public PlaybackManager::PlaybackStateHandler {

View File

@ -156,7 +156,7 @@ private:
NonnullOwnPtr<PlaybackStateHandler> m_playback_handler;
Optional<FrameQueueItem> m_next_frame;
u64 m_skipped_frames;
u64 m_skipped_frames { 0 };
// This is a nested class to allow private access.
class PlaybackStateHandler {