Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pygobject pygobject
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 179
    • Issues 179
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 28
    • Merge requests 28
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • pygobjectpygobject
  • Issues
  • #219

New default SIGINT handling confuses garbage collection.

The new default SIGINT handler ( https://github.com/GNOME/pygobject/commit/58f677bfaa0f117465a9e2146c5d83768b5a76ac ) uses a callback stack which keeps pointers to a Gio.Application.quit method, preventing garbage collection on the application in python3. Try:

python TESTGC.py

python TESTGC.py SIGINT

python3 TESTGC.py

python3 TESTGC.py SIGINT

Trying to figure out how this stack evolved at runtime, I had the impression that a much more "naïve" approach would give the same results with cleaner code. Namely (almost) always install new handler, always add to / pop from stack, and only try to figure out what is really happening in two locations: I. On module initialisation, install our handler only over the default handler, II. When handler is called (so hasn't been changed yet), make sure the GLib has not installed anything either.

Side effects: adding to / popping from stack is not much more expensive than checking whether we need to, but one may be surprised to see that the default python sigint handler has changed.

Cheers, Itaï

TESTGC.py

simplify_default_sigint.diff

Edited May 10, 2018 by Itaï BEN YAACOV
Assignee
Assign to
Time tracking