[haiku-commits] r33662 - haiku/trunk/src/apps/mediaplayer

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 19 Oct 2009 20:27:48 +0200 (CEST)

Author: stippi
Date: 2009-10-19 20:27:48 +0200 (Mon, 19 Oct 2009)
New Revision: 33662
Changeset: http://dev.haiku-os.org/changeset/33662/haiku

Modified:
   haiku/trunk/src/apps/mediaplayer/Controller.cpp
   haiku/trunk/src/apps/mediaplayer/MainWin.cpp
Log:
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).


Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/Controller.cpp     2009-10-19 18:24:51 UTC 
(rev 33661)
+++ haiku/trunk/src/apps/mediaplayer/Controller.cpp     2009-10-19 18:27:48 UTC 
(rev 33662)
@@ -121,10 +121,7 @@
 Controller::~Controller()
 {
        Settings::Default()->RemoveListener(&fGlobalSettingsListener);
-
-       if (fMediaFile)
-               fMediaFile->ReleaseAllTracks();
-       delete fMediaFile;
+       SetTo(NULL);
 }
 
 

Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2009-10-19 18:24:51 UTC 
(rev 33661)
+++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2009-10-19 18:27:48 UTC 
(rev 33662)
@@ -205,8 +205,11 @@
 
        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 @@
                        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


Other related posts:

  • » [haiku-commits] r33662 - haiku/trunk/src/apps/mediaplayer - superstippi