[gcompris-devel] Question on memory

pgeorges pascal.georges1 at free.fr
Sun Nov 11 00:03:03 UTC 2001


In clic_on_letter.c I put following code at line 200 :

/* ==================================== */
/* Destroy all the items */
static void clic_on_letter_destroy_all_items()
{
  if(boardRootItem!=NULL)
    gtk_object_destroy (GTK_OBJECT(boardRootItem));

    // Is the following needed ? It seems to segfault
/*  gtk_object_destroy (GTK_OBJECT(l1_item));
  gtk_object_destroy (GTK_OBJECT(l2_item));
  gtk_object_destroy (GTK_OBJECT(l3_item));
  gtk_object_destroy (GTK_OBJECT(l4_item));
  gtk_object_destroy (GTK_OBJECT(button1));
  gtk_object_destroy (GTK_OBJECT(button2));
  gtk_object_destroy (GTK_OBJECT(button3));
  gtk_object_destroy (GTK_OBJECT(button4));
*/
  boardRootItem = NULL;
}

Could anybody tell me if the commented code is needed or not (to avoid
memory leak) ?






More information about the Gcompris-devel mailing list