Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,430
    • Issues 1,430
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 242
    • Merge requests 242
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gtkgtk
  • Issues
  • #706

Closed
Open
Created Nov 19, 2016 by Bugzilla@bugzilla-migration💬Reporter

GtkNotebook does not unref all GtkLabel it creates

Submitted by Massimo

Link to original bug (#774706)

Description

After setting GOBJECT_DEBUG=objects comparing the outputs of the following program run with ITERATIONS set to 2 and 1:

#include <gtk/gtk.h>

#ifndef ITERATIONS #define ITERATIONS 2 #endif

int main (int argc, char *argv[]) {
int i; if (gtk_init_check (&argc, &argv)) for (i = 0; i < ITERATIONS; ++i) { GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); GtkWidget *notebook = gtk_notebook_new (); GtkWidget *page = gtk_drawing_area_new ();

    gtk_container_add (GTK_CONTAINER (window), notebook);
    
    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
  
    gtk_widget_destroy (window);
  }

return 0; }

the number of objects alive at exit increases for the presence of few GtkLabel objects.

The problem is here:

https://git.gnome.org/browse/gtk+/tree/gtk/gtknotebook.c?h=gtk-3-22#n6967

page->tab_label is parented to the notebook which implements GtkContainer::remove to remove children (pages), but does nothing with tab_label, so it is wrong to call gtk_widget_destroy here because it does not properly complete the destruction.

Version: 3.22.x

Assignee
Assign to
Time tracking