mpx/playbackframework/playbackserver/src/mpxplaybackserver.cpp
branchRCL_3
changeset 23 4740b34b83ce
parent 15 d240f0a77280
child 34 e257e2b6459d
--- a/mpx/playbackframework/playbackserver/src/mpxplaybackserver.cpp	Wed Apr 14 16:28:17 2010 +0300
+++ b/mpx/playbackframework/playbackserver/src/mpxplaybackserver.cpp	Tue Apr 27 17:09:22 2010 +0300
@@ -196,8 +196,16 @@
             if (cl->ClientCount()==0)
                 {
                 MPX_DEBUG1("CMPXPlaybackServer::RemoveClient delete a player");
+                CMPXPlaybackEngine* enginePtr = p; 
                 delete p;
-                iPlayers.Remove(i);
+				//Due to callbacks in PlaybackServer we have to remove engine from the iPlayers array after deleting.
+                //enginePtr is a invalid pointer as p is already deleted
+    		    //Find the index of deleted engine using its address
+				TInt engineIndex = iPlayers.Find(enginePtr);
+                if ( engineIndex != KErrNotFound )
+                    {
+                    iPlayers.Remove(engineIndex);
+                    }
                 }
             break;
             }