[Tux4kids-commits] r435 - in tuxmath/trunk: . doc po src
dbruce-guest at alioth.debian.org
dbruce-guest at alioth.debian.org
Sat Feb 23 12:49:27 UTC 2008
Author: dbruce-guest
Date: 2008-02-23 12:49:26 +0000 (Sat, 23 Feb 2008)
New Revision: 435
Modified:
tuxmath/trunk/doc/changelog
tuxmath/trunk/notesblurb
tuxmath/trunk/po/LINGUAS
tuxmath/trunk/po/en_GB.po
tuxmath/trunk/src/setup.c
tuxmath/trunk/src/tuxmath.c
Log:
bugfix in cleanup() in setup.c to avoid segfaults due to double free() when closing window.
Modified: tuxmath/trunk/doc/changelog
===================================================================
--- tuxmath/trunk/doc/changelog 2008-02-22 19:54:22 UTC (rev 434)
+++ tuxmath/trunk/doc/changelog 2008-02-23 12:49:26 UTC (rev 435)
@@ -1,7 +1,16 @@
+2008.Feb.23 (svn.debian.org/tux4kids - revision 435)
+ code:
+ Added some additional pointer checks to cleanup() in setup.c
+ to fix segfaults when exiting due to window close events, as
+ cleanup() gets called twice in that code path and we were
+ getting double free() errors.
+
+ David Bruce <dbruce at tampabay.rr.com>
+
2008.Feb.12 (svn.debian.org/tux4kids - revision 427)
i18n:
- Added updated Hungarian translation (contributed by Miklós
- Merényi) that includes the help text strings
+ Added updated Hungarian translation (contributed by Mikl�s
+ Mer�nyi) that includes the help text strings
Committed by Tim Holy <holy at wustl.edu>
Modified: tuxmath/trunk/notesblurb
===================================================================
--- tuxmath/trunk/notesblurb 2008-02-22 19:54:22 UTC (rev 434)
+++ tuxmath/trunk/notesblurb 2008-02-23 12:49:26 UTC (rev 435)
@@ -1,3 +1,3 @@
-Source tar.gz archive for TuxMath 1.6.0, including the Andika font. Suitable for installation on Unix-style systems using a simple "./configure; make; make install".
+Source tar.gz archive for TuxMath 1.6.1, including the Andika font. Suitable for installation on Unix-style systems using a simple "./configure; make; make install". This now includes MacOSX as long as you have the needed libs (tested on MacOS 10.5 "Leopard").
Build requires the *-dev files for SDL, SDL_image, SDL_mixer, and SDL_ttf. Gnu gettext is no longer required for installation. All of these should be easily available in most Gnu-Linux distributions. The Gnu Autotools are not needed to build from this package.
\ No newline at end of file
Modified: tuxmath/trunk/po/LINGUAS
===================================================================
--- tuxmath/trunk/po/LINGUAS 2008-02-22 19:54:22 UTC (rev 434)
+++ tuxmath/trunk/po/LINGUAS 2008-02-23 12:49:26 UTC (rev 435)
@@ -1,5 +1,6 @@
# Set of available languages.
cs
+en_GB
fr
hu
nb
Modified: tuxmath/trunk/po/en_GB.po
===================================================================
--- tuxmath/trunk/po/en_GB.po 2008-02-22 19:54:22 UTC (rev 434)
+++ tuxmath/trunk/po/en_GB.po 2008-02-23 12:49:26 UTC (rev 435)
@@ -451,4 +451,3 @@
#: data/missions/lessons/descr_lessons:56
msgid "Division of Positives and Negatives"
msgstr "Division of Positives and Negatives"
-
Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c 2008-02-22 19:54:22 UTC (rev 434)
+++ tuxmath/trunk/src/setup.c 2008-02-23 12:49:26 UTC (rev 435)
@@ -620,6 +620,11 @@
/* free any heap memory used during game DSB */
/* and also quit SDL properly: */
+/* NOTE - this function will get called twice if */
+/* exit occurs because of window close, so we */
+/* need to check all pointers before freeing them, */
+/* and set them to NULL after freeing them, so we */
+/* avoid segfaults at exit from double free() */
void cleanup_memory(void)
{
/* Free all images and sounds used by SDL: */
@@ -627,8 +632,12 @@
int frequency,channels,n_timesopened;
Uint16 format;
- TTF_CloseFont(default_font);
- TTF_Quit();
+ if(default_font)
+ {
+ TTF_CloseFont(default_font);
+ default_font = NULL;
+ TTF_Quit();
+ }
for (i = 0; i < NUM_IMAGES; i++)
{
@@ -651,17 +660,40 @@
musics[i] = NULL;
}
- for (i = 0; i < num_lessons; i++) {
- free(lesson_list_titles[i]);
- free(lesson_list_filenames[i]);
+ if (lesson_list_titles)
+ {
+ for (i = 0; i < num_lessons; i++)
+ {
+ if (lesson_list_titles[i])
+ {
+ free(lesson_list_titles[i]);
+ lesson_list_titles[i] = NULL;
+ }
+ }
+ free(lesson_list_titles);
+ lesson_list_titles = NULL;
}
- free(lesson_list_titles);
- free(lesson_list_filenames);
- free(lesson_list_goldstars);
- lesson_list_titles = NULL;
- lesson_list_filenames = NULL;
- lesson_list_goldstars = NULL;
+ if (lesson_list_filenames)
+ {
+ for (i = 0; i < num_lessons; i++)
+ {
+ if (lesson_list_filenames[i])
+ {
+ free(lesson_list_filenames[i]);
+ lesson_list_filenames[i] = NULL;
+ }
+ }
+ free(lesson_list_filenames);
+ lesson_list_filenames = NULL;
+ }
+
+ if (lesson_list_goldstars)
+ {
+ free(lesson_list_goldstars);
+ lesson_list_goldstars = NULL;
+ }
+
// Close the audio mixer. We have to do this at least as many times
// as it was opened.
n_timesopened = Mix_QuerySpec(&frequency,&format,&channels);
@@ -681,10 +713,6 @@
-
-
-
-
/* Set the application's icon: */
void seticon(void)
Modified: tuxmath/trunk/src/tuxmath.c
===================================================================
--- tuxmath/trunk/src/tuxmath.c 2008-02-22 19:54:22 UTC (rev 434)
+++ tuxmath/trunk/src/tuxmath.c 2008-02-23 12:49:26 UTC (rev 435)
@@ -35,7 +35,6 @@
int main(int argc, char * argv[])
{
-#ifndef MACOSX
char *s1, *s2, *s3, *s4;
s1 = setlocale(LC_ALL, "");
@@ -54,7 +53,6 @@
fprintf(stderr, "After gettext() call\n");
#endif
-#endif
atexit(cleanup); // register it so we clean up even if there is a crash
setup(argc, argv);
More information about the Tux4kids-commits
mailing list