]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/commands/cmd_change_skin.cpp
Fix unprotected access of input item (skins2).
[vlc] / modules / gui / skins2 / commands / cmd_change_skin.cpp
index c09e9ec43694412364ec6534916f351c6ecb862f..ce31e23df6b0ab818618e00a3c978a224bbe451c 100644 (file)
@@ -5,7 +5,7 @@
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulière <ipkiss@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "cmd_change_skin.hpp"
@@ -38,6 +38,7 @@ void CmdChangeSkin::execute()
 
     if( pOldTheme )
     {
+        pOldTheme->getWindowManager().saveVisibility();
         pOldTheme->getWindowManager().hideAll();
     }
 
@@ -45,23 +46,20 @@ void CmdChangeSkin::execute()
     if( loader.load( m_file ) )
     {
         // Everything went well
-        msg_Dbg( getIntf(), "New theme successfully loaded (%s)",
+        msg_Info( getIntf(), "new theme successfully loaded (%s)",
                  m_file.c_str() );
-        if( pOldTheme )
-        {
-            delete pOldTheme;
-        }
+        delete pOldTheme;
     }
     else if( pOldTheme )
     {
-        msg_Err( getIntf(), "A problem occurred when loading the new theme,"
+        msg_Warn( getIntf(), "a problem occurred when loading the new theme,"
                   " restoring the previous one" );
         getIntf()->p_sys->p_theme = pOldTheme;
-        pOldTheme->getWindowManager().showAll();
+        pOldTheme->getWindowManager().restoreVisibility();
     }
     else
     {
-        msg_Err( getIntf(), "Cannot load the theme, aborting" );
+        msg_Err( getIntf(), "cannot load the theme, aborting" );
         // Quit
         CmdQuit cmd( getIntf() );
         cmd.execute();