Style cleanup.

When asked to toggle playback, PlaybackManager never checked if it had a previous playback state to copy from. This caused a crash if playback was toggled via the keyboard when no file was loaded. Fixes ticket #2664 .


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27194 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2008-08-25 00:40:10 +00:00
parent b9f431f1df
commit df5d28d4d9
2 changed files with 25 additions and 22 deletions
+21 -21
View File
@@ -81,33 +81,33 @@ void Controller::Listener::MutedChanged(bool) {}
Controller::Controller() Controller::Controller()
: NodeManager() : NodeManager(),
, fVideoView(NULL) fVideoView(NULL),
, fVolume(1.0) fVolume(1.0),
, fMuted(false) fMuted(false),
, fRef() fRef(),
, fMediaFile(NULL) fMediaFile(NULL),
, fVideoSupplier(new ProxyVideoSupplier()) fVideoSupplier(new ProxyVideoSupplier()),
, fAudioSupplier(new ProxyAudioSupplier(this)) fAudioSupplier(new ProxyAudioSupplier(this)),
, fVideoTrackSupplier(NULL) fVideoTrackSupplier(NULL),
, fAudioTrackSupplier(NULL) fAudioTrackSupplier(NULL),
, fAudioTrackList(4) fAudioTrackList(4),
, fVideoTrackList(2) fVideoTrackList(2),
, fPosition(0) fPosition(0),
, fDuration(0) fDuration(0),
, fVideoFrameRate(25.0) fVideoFrameRate(25.0),
, fSeekFrame(-1) fSeekFrame(-1),
, fLastSeekEventTime(LONGLONG_MIN) fLastSeekEventTime(LONGLONG_MIN),
, fAutoplay(true) fAutoplay(true),
, fPauseAtEndOfStream(false) fPauseAtEndOfStream(false),
, fSeekToStartAfterPause(false) fSeekToStartAfterPause(false),
, fListeners(4) fListeners(4)
{ {
fStopped = fAutoplay ? false : true; fStopped = fAutoplay ? false : true;
} }
@@ -371,8 +371,11 @@ PlaybackManager::SetCurrentFrame(int64 frame)
void void
PlaybackManager::SetPlayMode(int32 mode, bool continuePlaying) PlaybackManager::SetPlayMode(int32 mode, bool continuePlaying)
{ {
PlayingState* lastState = _LastState();
if (lastState == NULL)
return;
//printf("PlaybackManager::SetPlayMode(%ld, %d)\n", mode, continuePlaying); //printf("PlaybackManager::SetPlayMode(%ld, %d)\n", mode, continuePlaying);
PlayingState* newState = new PlayingState(*_LastState()); PlayingState* newState = new PlayingState(*lastState);
newState->play_mode = mode; newState->play_mode = mode;
// Jump to the playing start frame if we should not continue, where we // Jump to the playing start frame if we should not continue, where we
// stop. // stop.