[MPlayer-cvslog] r36102 - in trunk/gui/dialog: about.c equalizer.c fileselect.c msgbox.c playlist.c preferences.c skinbrowser.c url.c

ib subversion at mplayerhq.hu
Sat Mar 30 15:32:07 CET 2013


Author: ib
Date: Sat Mar 30 15:32:07 2013
New Revision: 36102

Log:
Don't use WidgetDestroy().

(It's not the best idea to call gtk_widget_destroy() there while the
object is currently being destroyed.)

In order to set the widget pointer to NULL, use gtk_widget_destroyed().

Simply destroy the widget to automatically get the pointer set to NULL
then.

Modified:
   trunk/gui/dialog/about.c
   trunk/gui/dialog/equalizer.c
   trunk/gui/dialog/fileselect.c
   trunk/gui/dialog/msgbox.c
   trunk/gui/dialog/playlist.c
   trunk/gui/dialog/preferences.c
   trunk/gui/dialog/skinbrowser.c
   trunk/gui/dialog/url.c

Modified: trunk/gui/dialog/about.c
==============================================================================
--- trunk/gui/dialog/about.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/about.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -29,7 +29,7 @@
 GtkWidget * About = NULL;
 
 static void abWidgetDestroy( GtkButton * button, gpointer user_data )
-{ WidgetDestroy( NULL,&About ); }
+{ gtk_widget_destroy( About ); }
 
 static GtkWidget * CreateAbout( void )
 {
@@ -335,7 +335,7 @@ static GtkWidget * CreateAbout( void )
   AddHSeparator( vbox );
   Ok=AddButton( MSGTR_Ok,AddHButtonBox( vbox ) );
 
-  gtk_signal_connect( GTK_OBJECT( About ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&About );
+  gtk_signal_connect( GTK_OBJECT( About ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&About );
   gtk_signal_connect_object( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( abWidgetDestroy ),NULL );
 
   gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );

Modified: trunk/gui/dialog/equalizer.c
==============================================================================
--- trunk/gui/dialog/equalizer.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/equalizer.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -174,12 +174,7 @@ static void eqButtonReleased( GtkButton 
   {
    case 0:
         gtk_widget_destroy( Equalizer );
-        Equalizer=NULL;
-        if ( EquConfig )
-         {
-          gtk_widget_destroy( EquConfig );
-          EquConfig=NULL;
-         }
+        if ( EquConfig ) gtk_widget_destroy( EquConfig );
         break;
    case 1:
 	if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 )
@@ -424,7 +419,7 @@ static GtkWidget * CreateEqualizer( void
   gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
   gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
 
-  gtk_signal_connect( GTK_OBJECT( Equalizer ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Equalizer );
+  gtk_signal_connect( GTK_OBJECT( Equalizer ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&Equalizer );
   gtk_signal_connect( GTK_OBJECT( Equalizer ),"focus_in_event",GTK_SIGNAL_FUNC( eqFocus ),(void *)2 );
 
   gtk_signal_connect( GTK_OBJECT( ChannelsList ),"select_row",GTK_SIGNAL_FUNC( eqSelectChannelsListRow ),NULL );
@@ -564,7 +559,6 @@ static void ecButtonReleased( GtkButton 
   eqSetChannelNames();
  }
  gtk_widget_destroy( EquConfig );
- EquConfig=NULL;
 }
 
 GtkWidget * CreateEquConfig( void )
@@ -677,7 +671,7 @@ GtkWidget * CreateEquConfig( void )
   gtk_widget_add_accelerator( ecOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
   gtk_widget_add_accelerator( ecCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
-  gtk_signal_connect( GTK_OBJECT( EquConfig ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&EquConfig );
+  gtk_signal_connect( GTK_OBJECT( EquConfig ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&EquConfig );
 
   gtk_signal_connect( GTK_OBJECT( ecOk ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)1 );
   gtk_signal_connect( GTK_OBJECT( ecCancel ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)0 );

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/fileselect.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -382,7 +382,6 @@ static void fs_Up_released( GtkButton * 
 static void fs_Cancel_released( GtkButton * button,gpointer user_data )
 {
  gtk_widget_destroy( FileSelector );
- FileSelector=NULL;
  fsLastFNameListSelected = fsCurrFNameListSelected;
 }
 
@@ -507,7 +506,7 @@ static gboolean fs_fsFNameList_event( Gt
 
 static void fs_Destroy( void )
 {
- WidgetDestroy( FileSelector, &FileSelector );
+ gtk_widget_destroyed( FileSelector, &FileSelector );
 
  g_hash_table_destroy( fsPathTable );
 

Modified: trunk/gui/dialog/msgbox.c
==============================================================================
--- trunk/gui/dialog/msgbox.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/msgbox.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -34,7 +34,6 @@ GtkWidget * MessageBox = NULL;
 static void on_Ok_released( GtkButton * button,gpointer user_data  )
 {
  gtk_widget_destroy( MessageBox );
- MessageBox=NULL;
 }
 
 static GtkWidget * CreateMessageBox( void )
@@ -98,7 +97,7 @@ static GtkWidget * CreateMessageBox( voi
  gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
  gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
- gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox );
+ gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&MessageBox );
  gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL );
 
  gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group );

Modified: trunk/gui/dialog/playlist.c
==============================================================================
--- trunk/gui/dialog/playlist.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/playlist.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -171,7 +171,6 @@ static void plButtonReleased( GtkButton 
        free( old_path );
        old_path=strdup( current_path );
        gtk_widget_destroy( Playlist );
-       Playlist=NULL;
        break;
   case 2: // remove
        {
@@ -541,7 +540,7 @@ static GtkWidget * CreatePlaylist( void 
 
   gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
-  gtk_signal_connect( GTK_OBJECT( Playlist ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Playlist );
+  gtk_signal_connect( GTK_OBJECT( Playlist ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&Playlist );
 
   gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 );
   gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 );

Modified: trunk/gui/dialog/preferences.c
==============================================================================
--- trunk/gui/dialog/preferences.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/preferences.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -341,18 +341,9 @@ static void prButton( GtkButton * button
 
    case bCancel:
 	gtk_widget_destroy( Preferences );
-	Preferences=NULL;
-	if ( AudioConfig )
-	{
-	 gtk_widget_destroy( AudioConfig );
-	 AudioConfig=NULL;
-	}
+	if ( AudioConfig ) gtk_widget_destroy( AudioConfig );
 #ifdef CONFIG_DXR3
-	if ( DXR3Config )
-	{
-	 gtk_widget_destroy( DXR3Config );
-	 DXR3Config=NULL;
-	}
+	if ( DXR3Config ) gtk_widget_destroy( DXR3Config );
 #endif
 	break;
    case bAConfig:
@@ -1036,7 +1027,7 @@ static GtkWidget * CreatePreferences( vo
   gtk_widget_add_accelerator( BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
   gtk_widget_add_accelerator( BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
-  gtk_signal_connect( GTK_OBJECT( Preferences ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Preferences );
+  gtk_signal_connect( GTK_OBJECT( Preferences ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&Preferences );
 
   gtk_signal_connect( GTK_OBJECT( AConfig ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bAConfig );
   gtk_signal_connect( GTK_OBJECT( BOk ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bOk );
@@ -1544,7 +1535,6 @@ static void audioButton(GtkButton *butto
 #endif
    case 0:
       gtk_widget_destroy(AudioConfig);
-      AudioConfig=NULL;
       break;
   }
 }
@@ -1657,7 +1647,7 @@ static GtkWidget *CreateAudioConfig( voi
   BAudioOk = AddButton(MSGTR_Ok, hbuttonbox);
   BAudioCancel = AddButton(MSGTR_Cancel, hbuttonbox);
 
-  gtk_signal_connect(GTK_OBJECT(AudioConfig), "destroy", GTK_SIGNAL_FUNC(WidgetDestroy), &AudioConfig);
+  gtk_signal_connect(GTK_OBJECT(AudioConfig), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &AudioConfig);
   gtk_signal_connect(GTK_OBJECT(BAudioOk), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)1);
   gtk_signal_connect(GTK_OBJECT(BAudioCancel), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)0);
 
@@ -1737,7 +1727,6 @@ static void dxr3Button( GtkButton * butt
        gtkVfLAVC=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBVLavc ) );
   case 1: // Cancel
        gtk_widget_destroy( DXR3Config );
-       DXR3Config=NULL;
        break;
  }
 }
@@ -1805,7 +1794,7 @@ GtkWidget * CreateDXR3Config( void )
  gtk_widget_add_accelerator( dxr3BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
  gtk_widget_add_accelerator( dxr3BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
- gtk_signal_connect( GTK_OBJECT( DXR3Config ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&DXR3Config );
+ gtk_signal_connect( GTK_OBJECT( DXR3Config ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&DXR3Config );
 
  gtk_signal_connect( GTK_OBJECT( dxr3BOk ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)0 );
  gtk_signal_connect( GTK_OBJECT( dxr3BCancel ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)1 );

Modified: trunk/gui/dialog/skinbrowser.c
==============================================================================
--- trunk/gui/dialog/skinbrowser.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/skinbrowser.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -61,7 +61,6 @@ static void prButton( GtkButton * button
   }
  }
  gtk_widget_destroy( SkinBrowser );
- SkinBrowser=NULL;
 }
 
 static void on_SkinList_select_row( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
@@ -79,7 +78,6 @@ static void on_SkinList_select_row( GtkC
    free( skinName );
    skinName=strdup( sbSelectedSkin );
    gtk_widget_destroy( SkinBrowser );
-   SkinBrowser=NULL;
   }
 }
 
@@ -145,7 +143,7 @@ static GtkWidget * CreateSkinBrowser( vo
  gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
  gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
- gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&SkinBrowser );
+ gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&SkinBrowser );
  gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row",GTK_SIGNAL_FUNC( on_SkinList_select_row ),NULL );
  gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 );
  gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 );

Modified: trunk/gui/dialog/url.c
==============================================================================
--- trunk/gui/dialog/url.c	Sat Mar 30 15:13:23 2013	(r36101)
+++ trunk/gui/dialog/url.c	Sat Mar 30 15:32:07 2013	(r36102)
@@ -72,7 +72,6 @@ static void on_Button_pressed( GtkButton
     }
   }
  gtk_widget_destroy( URLDialog );
- URLDialog = NULL;
 }
 
 static GtkWidget * CreateURLDialog( void )
@@ -126,7 +125,7 @@ static GtkWidget * CreateURLDialog( void
  gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
  gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
- gtk_signal_connect( GTK_OBJECT( URLDialog ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&URLDialog );
+ gtk_signal_connect( GTK_OBJECT( URLDialog ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&URLDialog );
  gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 );
  gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL );
 


More information about the MPlayer-cvslog mailing list