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,500
    • Issues 1,500
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 251
    • Merge requests 251
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • 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
  • Merge requests
  • !4638

Fix infinite loop

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Rastersoft requested to merge rastersoft/gtk:fix_infinite_loop into main Apr 15, 2022
  • Overview 8
  • Commits 1
  • Pipelines 3
  • Changes 1

In some cases, when removing a GtkWidget from a GtkPaned, the code enters in an infinite loop, showing over and over again the message

(test_gtk4:18277): Gtk-CRITICAL **: 00:22:19.677: gtk_widget_get_parent: assertion ‘GTK_IS_WIDGET (widget)’ failed

This happens because in the method gtk_paned_set_focus_child() there is a loop to find the top element with the focus. But that loop only stops when it arrives to the paned itself.

In some cases this condition is never met. An example is if inside the paned is a GtkBox with a button, and pressing the button removes the GtkBox from the GtkPaned. This, by itself, doesn't present any problem. But if the button callback removes first the button from the GtkBox, and then the callback removes the GtkBox from the GtkPaned, the loop in gtk_paned_set_focus_child() enters in an infinite loop, because the GtkButton, which was the widget with the focus, isn't inside the GtkPaned, so asking recursively for their parents will never arrive to the GtkPaned.

This patch fixes this by stopping the loop if the parent is NULL.

Fix #4847

Edited Apr 15, 2022 by Rastersoft
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fix_infinite_loop