Solved a few problems at program exit. The window needs to lock the playback

manager and inform it that the video target, ie the view will be gone. The
Controller needs to use the SetTo() method in order to actually close down
the nodes properly in the destructor. Otherwise asynchronous threads will use
the BMediaFile and tracks after it has been deleted (until the NodeManager
destructor is executed).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33662 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-10-19 18:27:48 +00:00
parent 9e43353ce5
commit 52a90fe6be
2 changed files with 16 additions and 6 deletions

View File

@ -121,10 +121,7 @@ Controller::Controller()
Controller::~Controller()
{
Settings::Default()->RemoveListener(&fGlobalSettingsListener);
if (fMediaFile)
fMediaFile->ReleaseAllTracks();
delete fMediaFile;
SetTo(NULL);
}

View File

@ -205,8 +205,11 @@ MainWin::~MainWin()
Settings::Default()->RemoveListener(&fGlobalSettingsListener);
fPlaylist->RemoveListener(fPlaylistObserver);
fController->Lock();
fController->RemoveListener(fControllerObserver);
fController->SetPeakListener(NULL);
fController->SetVideoTarget(NULL);
fController->Unlock();
// give the views a chance to detach from any notifiers
// before we delete them
@ -363,13 +366,23 @@ MainWin::MessageReceived(BMessage *msg)
break;
case M_MEDIA_SERVER_STARTED:
{
printf("TODO: implement M_MEDIA_SERVER_STARTED\n");
// fController->...
//
// BAutolock _(fPlaylist);
// BMessage fakePlaylistMessage(MSG_PLAYLIST_CURRENT_ITEM_CHANGED);
// fakePlaylistMessage.AddInt32("index",
// fPlaylist->CurrentItemIndex());
// PostMessage(&fakePlaylistMessage);
break;
}
case M_MEDIA_SERVER_QUIT:
printf("TODO: implement M_MEDIA_SERVER_QUIT\n");
// fController->...
// if (fController->Lock()) {
// fController->CleanupNodes();
// fController->Unlock();
// }
break;
// PlaylistObserver messages