Skip to content

plugins: explicitly specify Gtk 3.0, Gdk 3.0, and GtkSource 4 typelib versions (#757) - #760

Open
ronitgupta138 wants to merge 2 commits into
linuxmint:masterfrom
ronitgupta138:fix/plugins-require-gtk3-typelib-version
Open

ronitgupta138 wants to merge 2 commits into
linuxmint:masterfrom
ronitgupta138:fix/plugins-require-gtk3-typelib-version

Conversation

@ronitgupta138

Copy link
Copy Markdown

Fixes #757

Root Cause

When both GTK3 and GTK4 are present on a system, PyGObject without explicit gi.require_version() calls defaults to the highest available typelib version (e.g. Gtk-4.0, Gdk-4.0). When libpeas loads Python plugins into the xed GTK3 process, loading the GTK4 typelib causes type registration collisions and locks the process at startup.

Summary of Changes

  • Added explicit gi.require_version('Gtk', '3.0') and gi.require_version('Gdk', '3.0') across all Python plugins (bracketcompletion, joinlines, open-uri-context-menu, textsize).
  • Added gi.require_version('GtkSource', '4') to open-uri-context-menu.
  • Ensured Xed and Peas versions are explicitly specified.

Copilot AI lite review requested due to automatic review settings September 27, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The affected plugins request unavailable Xed 3.0 typelibs and fail before loading.

Review effort: Lite
Findings: 4 High severity

Open (4)
What changed in this PR

This PR pins GTK-related typelib versions to prevent GTK4 conflicts in the GTK3 Xed process.

Changes:

  • Requires GTK 3.0 and Gdk 3.0 explicitly.
  • Pins GtkSource, Peas, and Xed typelibs.
  • Applies requirements across affected Python plugins.
File Summary
plugins/​textsize/​textsize/​documenthelper.py Adds explicit GTK and Gdk version requirements.
plugins/​textsize/​textsize/​__init__.py Adds GTK, Gdk, and Xed requirements; Xed 3.0 is unavailable and prevents loading.
plugins/​open-uri-context-menu/​open-uri-context-menu/​open-uri-context-menu.py Adds GTK, GtkSource, and Xed requirements; Xed 3.0 prevents loading.
plugins/​joinlines/​joinlines/​__init__.py Adds GTK and Xed requirements; Xed 3.0 prevents loading.
plugins/​bracket-complete/​bracket-complete/​bracketcompletion.py Adds GTK, Gdk, Peas, and Xed requirements; Xed 3.0 prevents loading.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

gi.require_version('Peas', '1.0')
#gi.require_version('Xed', '3.0')
from gi.repository import GObject, Gdk, Xed
gi.require_version('Xed', '3.0')
Comment thread plugins/joinlines/joinlines/__init__.py Outdated
@@ -1,3 +1,6 @@
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Xed', '3.0')
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GtkSource', '4')
gi.require_version('Xed', '3.0')
Comment thread plugins/textsize/textsize/__init__.py Outdated
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
gi.require_version('Xed', '3.0')
@ronitgupta138

Copy link
Copy Markdown
Author

Updated all gi.require_version('Xed', '1.0') calls across the plugins to match the generated Xed-1.0 namespace version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xed 3.8.9 hangs at startup when GTK4 is installed: Python plugins load Gtk-4.0 typelib into a GTK3 process

2 participants