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

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 30 Jan 2010 19:42:46 +0100 (CET)

Author: mmlr
Date: 2010-01-30 19:42:46 +0100 (Sat, 30 Jan 2010)
New Revision: 35348
Changeset: http://dev.haiku-os.org/changeset/35348/haiku

Modified:
   haiku/trunk/src/apps/mediaplayer/MainWin.cpp
Log:
Add some locking to accesing PlaylistItems in these two cases as suggested by
Stephan.


Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2010-01-30 18:17:22 UTC 
(rev 35347)
+++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2010-01-30 18:42:46 UTC 
(rev 35348)
@@ -487,6 +487,7 @@
                                case 8:
                                {
                                        if (msg->what == B_GET_PROPERTY) {
+                                               BAutolock _(fPlaylist);
                                                const PlaylistItem* item = 
fController->Item();
                                                if (item == NULL) {
                                                        result = B_NO_INIT;
@@ -2024,6 +2025,7 @@
 void
 MainWin::_SetFileAttributes()
 {
+       BAutolock locker(fPlaylist);
        const FilePlaylistItem* item
                = dynamic_cast<const FilePlaylistItem*>(fController->Item());
        if (item == NULL)
@@ -2034,6 +2036,8 @@
                if (node.InitCheck())
                        return;
 
+               locker.Unlock();
+
                // write duration
 
                attr_info info;


Other related posts: