]> git.saurik.com Git - wxWidgets.git/commitdiff
fix what seems to be a big memory leaks in SetPageImage()
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 22 Jan 2004 14:39:29 +0000 (14:39 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 22 Jan 2004 14:39:29 +0000 (14:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/notebook.cpp
src/gtk1/notebook.cpp

index 76baec9d8ea386ce8c9464a2b505bbff5c4d015b..07fdd247c714bf381742a20108bb751e4732b462 100644 (file)
@@ -430,17 +430,18 @@ bool wxNotebook::SetPageImage( size_t page, int image )
     {
         /* Case 2) or 4). There is already an image in the gtkhbox. Let's find it */
 
-        GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
-        while (child)
+        GList *children = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
+        for ( child = children; child; child = child->next )
         {
             if (GTK_IS_PIXMAP(child->data))
             {
                 pixmapwid = GTK_WIDGET(child->data);
                 break;
             }
-            child = child->next;
         }
 
+        g_list_free(children);
+
         /* We should have the pixmap widget now */
         wxASSERT(pixmapwid != NULL);
 
index 76baec9d8ea386ce8c9464a2b505bbff5c4d015b..07fdd247c714bf381742a20108bb751e4732b462 100644 (file)
@@ -430,17 +430,18 @@ bool wxNotebook::SetPageImage( size_t page, int image )
     {
         /* Case 2) or 4). There is already an image in the gtkhbox. Let's find it */
 
-        GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
-        while (child)
+        GList *children = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
+        for ( child = children; child; child = child->next )
         {
             if (GTK_IS_PIXMAP(child->data))
             {
                 pixmapwid = GTK_WIDGET(child->data);
                 break;
             }
-            child = child->next;
         }
 
+        g_list_free(children);
+
         /* We should have the pixmap widget now */
         wxASSERT(pixmapwid != NULL);