[xiph-commits] r10075 - trunk/planarity

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Mon Sep 26 03:32:37 PDT 2005


Author: xiphmont
Date: 2005-09-26 03:32:36 -0700 (Mon, 26 Sep 2005)
New Revision: 10075

Modified:
   trunk/planarity/main.c
   trunk/planarity/version.h
Log:
Correct a bug where the delete event is killing off the widget (and
game state) before we try to write it out.  Trap delete, undepoly
buttons, write state, mark widget gone and exit gracefully.



Modified: trunk/planarity/main.c
===================================================================
--- trunk/planarity/main.c	2005-09-26 09:48:18 UTC (rev 10074)
+++ trunk/planarity/main.c	2005-09-26 10:32:36 UTC (rev 10075)
@@ -93,6 +93,17 @@
   exit(0);
 }
 
+static void clean_exit_delete_post(Gameboard *g){
+  gameboard = 0;
+  gtk_main_quit();
+}
+
+static gint clean_exit_delete(gpointer p){
+  levelstate_write(statedir);
+  undeploy_buttons(gameboard,clean_exit_delete_post);
+  return 1;  // we're handling it, don't continue the delete chain
+}
+
 int main(int argc, char *argv[]){
   char *homedir = getenv("home");
   if(!homedir)
@@ -138,7 +149,7 @@
 
   toplevel_window   = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   g_signal_connect (G_OBJECT (toplevel_window), "delete-event",
-                    G_CALLBACK (gtk_main_quit), NULL);
+                    G_CALLBACK (clean_exit_delete), NULL);
   
   gameboard = gameboard_new();
   levelstate_read();
@@ -160,6 +171,7 @@
 
   gtk_main ();
 
-  levelstate_write();
+  if(gameboard !=0 )
+    levelstate_write();
   return 0;
 }

Modified: trunk/planarity/version.h
===================================================================
--- trunk/planarity/version.h	2005-09-26 09:48:18 UTC (rev 10074)
+++ trunk/planarity/version.h	2005-09-26 10:32:36 UTC (rev 10075)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Mon Sep 26 05:46:43 EDT 2005] */
+/* DO NOT EDIT: Automated versioning hack [Mon Sep 26 06:29:46 EDT 2005] */



More information about the commits mailing list