changeset 36008:d154d0035cb0

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.
author ib
date Sat, 30 Mar 2013 14:32:07 +0000
parents 90ff4280cc80
children e7bc0058139a
files gui/dialog/about.c gui/dialog/equalizer.c gui/dialog/fileselect.c gui/dialog/msgbox.c gui/dialog/playlist.c gui/dialog/preferences.c gui/dialog/skinbrowser.c gui/dialog/url.c
diffstat 8 files changed, 15 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/about.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/about.c	Sat Mar 30 14:32:07 2013 +0000
@@ -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 @@
   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 );
--- a/gui/dialog/equalizer.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/equalizer.c	Sat Mar 30 14:32:07 2013 +0000
@@ -174,12 +174,7 @@
   {
    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 @@
   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 @@
   eqSetChannelNames();
  }
  gtk_widget_destroy( EquConfig );
- EquConfig=NULL;
 }
 
 GtkWidget * CreateEquConfig( void )
@@ -677,7 +671,7 @@
   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 );
--- a/gui/dialog/fileselect.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/fileselect.c	Sat Mar 30 14:32:07 2013 +0000
@@ -382,7 +382,6 @@
 static void fs_Cancel_released( GtkButton * button,gpointer user_data )
 {
  gtk_widget_destroy( FileSelector );
- FileSelector=NULL;
  fsLastFNameListSelected = fsCurrFNameListSelected;
 }
 
@@ -507,7 +506,7 @@
 
 static void fs_Destroy( void )
 {
- WidgetDestroy( FileSelector, &FileSelector );
+ gtk_widget_destroyed( FileSelector, &FileSelector );
 
  g_hash_table_destroy( fsPathTable );
 
--- a/gui/dialog/msgbox.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/msgbox.c	Sat Mar 30 14:32:07 2013 +0000
@@ -34,7 +34,6 @@
 static void on_Ok_released( GtkButton * button,gpointer user_data  )
 {
  gtk_widget_destroy( MessageBox );
- MessageBox=NULL;
 }
 
 static GtkWidget * CreateMessageBox( void )
@@ -98,7 +97,7 @@
  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 );
--- a/gui/dialog/playlist.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/playlist.c	Sat Mar 30 14:32:07 2013 +0000
@@ -171,7 +171,6 @@
        free( old_path );
        old_path=strdup( current_path );
        gtk_widget_destroy( Playlist );
-       Playlist=NULL;
        break;
   case 2: // remove
        {
@@ -541,7 +540,7 @@
 
   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 );
--- a/gui/dialog/preferences.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/preferences.c	Sat Mar 30 14:32:07 2013 +0000
@@ -341,18 +341,9 @@
 
    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 @@
   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 @@
 #endif
    case 0:
       gtk_widget_destroy(AudioConfig);
-      AudioConfig=NULL;
       break;
   }
 }
@@ -1657,7 +1647,7 @@
   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 @@
        gtkVfLAVC=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBVLavc ) );
   case 1: // Cancel
        gtk_widget_destroy( DXR3Config );
-       DXR3Config=NULL;
        break;
  }
 }
@@ -1805,7 +1794,7 @@
  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 );
--- a/gui/dialog/skinbrowser.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/skinbrowser.c	Sat Mar 30 14:32:07 2013 +0000
@@ -61,7 +61,6 @@
   }
  }
  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 @@
    free( skinName );
    skinName=strdup( sbSelectedSkin );
    gtk_widget_destroy( SkinBrowser );
-   SkinBrowser=NULL;
   }
 }
 
@@ -145,7 +143,7 @@
  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 );
--- a/gui/dialog/url.c	Sat Mar 30 14:13:23 2013 +0000
+++ b/gui/dialog/url.c	Sat Mar 30 14:32:07 2013 +0000
@@ -72,7 +72,6 @@
     }
   }
  gtk_widget_destroy( URLDialog );
- URLDialog = NULL;
 }
 
 static GtkWidget * CreateURLDialog( void )
@@ -126,7 +125,7 @@
  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 );