]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/input_manager.cpp
Use QPointer and QMutexLocker so we don't crash at Qt4 interface exit
[vlc] / modules / gui / wxwidgets / input_manager.cpp
index 2add7473e10a9bd194ef383cfeaf1f0df8ac27f1..9419e2ef07e74d20b21ed4076b515ee8741ce60d 100644 (file)
@@ -91,7 +91,7 @@ static LRESULT CALLBACK MovieSliderWindowProc(HWND hWnd, UINT uMsg, WPARAM wPara
 
                 /* following is only valid for horizontal a trackbar */
                 newpos = ((click.x-tRect.left-(thumb/2))*(max-min)+((tRect.right-tRect.left-thumb)/2))
-                      /(tRect.right-tRect.left-thumb);
+               /(tRect.right-tRect.left-thumb);
 
                 /* set new postion */
                 SendMessage(hWnd, TBM_SETPOS, TRUE, min+newpos);
@@ -122,7 +122,7 @@ InputManager::InputManager( intf_thread_t *_p_intf, Interface *_p_main_intf,
     p_input = NULL;
     i_old_playing_status = STATUS_STOP;
     i_old_rate = INPUT_RATE_DEFAULT;
-    b_slider_free = VLC_TRUE;
+    b_slider_free = true;
     i_input_hide_delay = 0;
 
     /* Create slider */
@@ -184,7 +184,7 @@ InputManager::~InputManager()
 /*****************************************************************************
  * Public methods.
  *****************************************************************************/
-vlc_bool_t InputManager::IsPlaying()
+bool InputManager::IsPlaying()
 {
     return (p_input && !p_input->b_die);
 }
@@ -194,9 +194,7 @@ vlc_bool_t InputManager::IsPlaying()
  *****************************************************************************/
 void InputManager::UpdateInput()
 {
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist != NULL )
     {
         LockPlaylist( p_intf->p_sys, p_playlist );
@@ -204,13 +202,13 @@ void InputManager::UpdateInput()
         if( p_intf->p_sys->p_input )
              vlc_object_yield( p_intf->p_sys->p_input );
         UnlockPlaylist( p_intf->p_sys, p_playlist );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 }
 
 void InputManager::UpdateNowPlaying()
 {
-    const char *psz_now_playing = input_item_GetNowPlaying( input_GetItem(p_input) );
+    char *psz_now_playing = input_item_GetNowPlaying( input_GetItem(p_input) );
     if( psz_now_playing && *psz_now_playing )
     {
         p_main_intf->statusbar->SetStatusText(
@@ -222,9 +220,10 @@ void InputManager::UpdateNowPlaying()
         p_main_intf->statusbar->SetStatusText(
                    wxU(input_GetItem(p_input)->psz_name), 2 );
     }
+    free( psz_now_playing );
 }
 
-void InputManager::UpdateButtons( vlc_bool_t b_play )
+void InputManager::UpdateButtons( bool b_play )
 {
     if( !b_play )
     {
@@ -364,7 +363,7 @@ void InputManager::Update()
     }
     else if( p_input->b_dead )
     {
-        UpdateButtons( VLC_FALSE );
+        UpdateButtons( false );
         vlc_object_release( p_input );
         p_input = NULL;
     }
@@ -378,7 +377,7 @@ void InputManager::Update()
         vlc_value_t pos, len;
 
         UpdateTime();
-        UpdateButtons( VLC_TRUE );
+        UpdateButtons( true );
         UpdateNowPlaying();
         UpdateDiscButtons();
 
@@ -434,7 +433,7 @@ void InputManager::OnDiscPrev( wxCommandEvent& WXUNUSED(event) )
     if( p_input )
     {
         int i_type = var_Type( p_input, "prev-chapter" );
-        vlc_value_t val; val.b_bool = VLC_TRUE;
+        vlc_value_t val; val.b_bool = true;
 
         var_Set( p_input, ( i_type & VLC_VAR_TYPE ) != 0 ?
                  "prev-chapter" : "prev-title", val );
@@ -451,7 +450,7 @@ void InputManager::OnDiscNext( wxCommandEvent& WXUNUSED(event) )
     if( p_input )
     {
         int i_type = var_Type( p_input, "next-chapter" );
-        vlc_value_t val; val.b_bool = VLC_TRUE;
+        vlc_value_t val; val.b_bool = true;
 
         var_Set( p_input, ( i_type & VLC_VAR_TYPE ) != 0 ?
                  "next-chapter" : "next-title", val );
@@ -477,11 +476,11 @@ void InputManager::OnSliderUpdate( wxScrollEvent& event )
         }
 
 #ifdef WIN32
-        b_slider_free = VLC_TRUE;
+        b_slider_free = true;
     }
     else
     {
-        b_slider_free = VLC_FALSE;
+        b_slider_free = false;
         if( p_intf->p_sys->p_input ) UpdateTime();
     }
 #endif