Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
pygobject
pygobject
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 239
    • Issues 239
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 10
    • Merge Requests 10
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • pygobjectpygobject
  • Issues
  • #383

Closed
Open
Opened Feb 07, 2020 by Martin Bakos@martinb214

from gi.repository import Gtk causes uninitialized accessible object

When importing Gtk.py from gi.repository in a script which does not call GTK main loop (Gtk.main()) the script generates uninitialized accessible object.

I have written the following small scripts to debug the issue:

  • dump_accessible.py: waits 2 seconds (the starting of app_starter.py), gets desktop from pyatspi registry and iterates through the open GTK applications. There is a timer at the end to see execution time of the listing of applications.
  • app_starter.py: starts gtk3-demo application, waits 20 seconds, and exits. With from gi.repository import Gtk bug appears.
  • dump_test.sh: starts the python scripts above.

Executing dump_test.sh returns the following output:

...
[application | Chromium]
[application | nautilus]
[application | gtk3-demo]
Elapsed time: 0.098

After adding from gi.repository import Gtk to app_starter.py the execution time of dump_accessible.py becomes very high and the uninitialized object appears:

...
[application | Chromium]
[application | nautilus]
[DEAD]
[application | gtk3-demo]
Elapsed time: 15.006

You can see that instead of [application | app_starter.py] I get a [DEAD] object. If I add Gtk.main() to app_starter.py then I get the right object and the time of listing returns to normal (< 1.000).

Tested it multiple operation systems and versions but the bug still exists:

  • OS version: Ubuntu 18.04
    gi version: 3.26.1
    GTK version: 3.22.30

  • OS version: Debian 10
    gi version 3.30.4
    GTK version: 3.24.5

IRL I use a third party library called Dogtail to test graphical application. Dogtail imports Gtk.py from gi therefore I cannot bypass this import but it breaks my tests.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/pygobject#383