Index: mythplugins/mythmusic/mythmusic/playbackbox.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/playbackbox.cpp	(revision 27015)
+++ mythplugins/mythmusic/mythmusic/playbackbox.cpp	(working copy)
@@ -468,7 +468,8 @@
                                             160, 160);
                 mainvisual->setVisual(visual_modes[current_visual]);
                 bannerDisable();
-                updateTrackInfo(curMeta);
+                if (curMeta)
+                    updateTrackInfo(curMeta);
 
                 if (!m_parent->IsExitingToMain())
                     handled = true;
@@ -1068,7 +1069,8 @@
 
         GenericTree *node = music_tree_list->getCurrentNode();
         curMeta = gMusicData->all_music->getMetadata(node->getInt());
-        updateTrackInfo(curMeta);
+        if (curMeta)
+            updateTrackInfo(curMeta);
 
         setShuffleMode(gPlayer->getShuffleMode());
 
@@ -1106,6 +1108,8 @@
                 if (scan_for_cd)
                     updatePlaylistFromCD();
 
+                cd_reader_thread->getLock()->lock();
+
                 music_tree_list->showWholeTree(show_whole_tree);
                 Q3ValueList <int> branches_to_current_node;
                 branches_to_current_node.append(0); //  Root node
@@ -1135,6 +1139,7 @@
                 if (curMeta)
                     updateTrackInfo(curMeta);
 
+                cd_reader_thread->getLock()->unlock();
                 return;     // Do not restart Timer
             }
             else
@@ -1357,7 +1362,8 @@
             gPlayer->getOutput()->SetTimecode(0);
     }
 
-    bannerEnable(curMeta, show_album_art);
+    if (curMeta)
+        bannerEnable(curMeta, show_album_art);
 }
 
 void PlaybackBoxMusic::visEnable()
@@ -1388,7 +1394,7 @@
 {
     if (mainvisual->bannerIsShowing())
         bannerDisable();
-    else
+    else if (mdata)
         bannerEnable(mdata, false);
 }
 
@@ -1801,7 +1807,8 @@
                         if (node)
                         {
                             curMeta = gMusicData->all_music->getMetadata(node->getInt());
-                            updateTrackInfo(curMeta);
+                            if (curMeta)
+                                updateTrackInfo(curMeta);
 
                             maxTime = curMeta->Length() / 1000;
 
@@ -1827,7 +1834,8 @@
                     if (node)
                     {
                         curMeta = gMusicData->all_music->getMetadata(node->getInt());
-                        updateTrackInfo(curMeta);
+                        if (curMeta)
+                            updateTrackInfo(curMeta);
 
                         maxTime = curMeta->Length() / 1000;
 
@@ -2069,24 +2077,27 @@
 
 void PlaybackBoxMusic::updateTrackInfo(Metadata *mdata)
 {
-    if (visualizer_status != 2)
+    if (mdata)
     {
-        if (title_text)
-            title_text->SetText(mdata->FormatTitle());
-        if (artist_text)
-            artist_text->SetText(mdata->FormatArtist());
-        if (album_text)
-            album_text->SetText(mdata->Album());
-        if (albumart_image)
-            showAlbumArtImage(mdata);
+        if (visualizer_status != 2)
+        {
+            if (title_text)
+                title_text->SetText(mdata->FormatTitle());
+            if (artist_text)
+                artist_text->SetText(mdata->FormatArtist());
+            if (album_text)
+                album_text->SetText(mdata->Album());
+            if (albumart_image)
+                showAlbumArtImage(mdata);
 
-        if (showrating)
-        {
-            if (ratings_image)
-                ratings_image->setRepeat(mdata->Rating());
+            if (showrating)
+            {
+                if (ratings_image)
+                    ratings_image->setRepeat(mdata->Rating());
+            }
         }
+        setTrackOnLCD(mdata);
     }
-    setTrackOnLCD(mdata);
 }
 
 void PlaybackBoxMusic::showAlbumArtImage(Metadata *mdata)
@@ -2164,9 +2175,9 @@
         }
 
         curMeta = gMusicData->all_music->getMetadata(node_int);
+        if (curMeta)
+            updateTrackInfo(curMeta);
 
-        updateTrackInfo(curMeta);
-
         maxTime = curMeta->Length() / 1000;
 
         QString time_string = getTimeString(maxTime, 0);
Index: mythplugins/mythmusic/mythmusic/main.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/main.cpp	(revision 27015)
+++ mythplugins/mythmusic/mythmusic/main.cpp	(working copy)
@@ -472,7 +472,15 @@
     }
 
     if (gCoreContext->GetNumSetting("AutoPlayCD", 0))
+    {
+        // Empty the playlist to ensure CD is played first
+        if (gMusicData->all_music)
+            gMusicData->all_music->clearCDData();
+        if (gMusicData->all_playlists)
+            gMusicData->all_playlists->clearCDList();
+
         runMusicPlayback();
+    }
     else
         mythplugin_run();
 }
Index: mythplugins/mythgallery/mythgallery/iconview.cpp
===================================================================
--- mythplugins/mythgallery/mythgallery/iconview.cpp	(revision 27015)
+++ mythplugins/mythgallery/mythgallery/iconview.cpp	(working copy)
@@ -492,10 +492,10 @@
                 {
                     QDir currentDir(m_currDir);
                     QDir rootDir(m_galleryDir);
-                    if (currentDir != rootDir) 
-                        HandleSubDirEscape(m_galleryDir);
-                    else 
+                    if (currentDir == rootDir) 
                         break;
+                    if ( !HandleSubDirEscape(m_galleryDir))
+                        break;
                 }
                 handled = HandleEscape();
             }
Index: mythtv/libs/libmyth/mythmediamonitor.cpp
===================================================================
--- mythtv/libs/libmyth/mythmediamonitor.cpp	(revision 27015)
+++ mythtv/libs/libmyth/mythmediamonitor.cpp	(working copy)
@@ -362,6 +362,9 @@
     {
         if ((*it)->getDevicePath() == dev)
         {
+            // Ensure device gets an unmount
+            (*it)->checkMedia();
+
             if (m_UseCount[*it] == 0)
             {
                 (*it)->deleteLater();
@@ -652,6 +655,8 @@
 
 
     GetMythMainWindow()->JumpTo("Main Menu");
+    while (GetMythMainWindow()->IsExitingToMain())
+        qApp->processEvents(); // Ensure jump is executed before calling handler
     handlers.at(selected).callback(pMedia);
 }
 
@@ -672,7 +677,9 @@
     // This gets called from outside the main thread so we need
     // to post an event back to the main thread.
     // We now send events for all non-error statuses, so plugins get ejects
-    if (m_SendEvent && stat != MEDIASTAT_ERROR && stat != MEDIASTAT_UNKNOWN)
+    if (m_SendEvent && stat != MEDIASTAT_ERROR && stat != MEDIASTAT_UNKNOWN &&
+        // Don't send an event for a new device that's not mounted
+        !(oldStatus == MEDIASTAT_UNPLUGGED && stat == MEDIASTAT_NOTMOUNTED))
     {
         // Should we ValidateAndLock() first?
         QEvent *e = new MediaEvent(stat, pMedia);
Index: mythtv/libs/libmyth/mythmediamonitor.cpp
===================================================================
--- mythtv/libs/libmyth/mythmediamonitor.cpp	(revision 27015)
+++ mythtv/libs/libmyth/mythmediamonitor.cpp	(working copy)
@@ -362,6 +362,9 @@
     {
         if ((*it)->getDevicePath() == dev)
         {
+            // Ensure device gets an unmount
+            (*it)->checkMedia();
+
             if (m_UseCount[*it] == 0)
             {
                 (*it)->deleteLater();
@@ -652,6 +655,8 @@
 
 
     GetMythMainWindow()->JumpTo("Main Menu");
+    while (GetMythMainWindow()->IsExitingToMain())
+        qApp->processEvents(); // Ensure jump is executed before calling handler
     handlers.at(selected).callback(pMedia);
 }
 
@@ -672,7 +677,9 @@
     // This gets called from outside the main thread so we need
     // to post an event back to the main thread.
     // We now send events for all non-error statuses, so plugins get ejects
-    if (m_SendEvent && stat != MEDIASTAT_ERROR && stat != MEDIASTAT_UNKNOWN)
+    if (m_SendEvent && stat != MEDIASTAT_ERROR && stat != MEDIASTAT_UNKNOWN &&
+        // Don't send an event for a new device that's not mounted
+        !(oldStatus == MEDIASTAT_UNPLUGGED && stat == MEDIASTAT_NOTMOUNTED))
     {
         // Should we ValidateAndLock() first?
         QEvent *e = new MediaEvent(stat, pMedia);
