https://bugs.kde.org/show_bug.cgi?id=501828

            Bug ID: 501828
           Summary: Permanent focus stealing _or_ crash with non-sense
                    Gtk4 code
    Classification: Plasma
           Product: kwin
           Version: 6.3.3
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: wayland-generic
          Assignee: kwin-bugs-n...@kde.org
          Reporter: pos...@posteo.eu
  Target Milestone: ---

SUMMARY

I've stumbled over the following two issues by accident:

1) If a Gtk4 popovermenu is set visible in the _closed_ event, it will re-open
and steal the focus: You can no longer click anything else, but need to kill
the app in another tty

2) If you additionally make the popover invisible afterwards, it will crash
kwin. Could reproduce it on Fedora 41 with Gtk 4.16.12 and openSUSE Tumbleweed
with Gtk 4.18.2, both running Kwin 6.3.3 Wayland.
If it doesn't crash immediately for you, keep clicking to close the popover,
eventually it should.

The code of course makes no sense, but I wanted to report it nonetheless. 


STEPS TO REPRODUCE

Here's a minimal  reproducer:

```
import gi
gi.require_version("Gtk", "4.0")

from gi.repository import Gtk
from gi.repository import GLib

def hide_popover(popover):
    popover.set_visible(False)

def on_closed(popover):
    print("popover closed")
    popover.set_visible(True)

    # The following line makes kwin eventually crash
    # Commment it out instead for permanent focus stealing
    GLib.timeout_add(100, hide_popover, popover)

def on_activate(app):
    win = Gtk.ApplicationWindow(application=app)

    popovermenu = Gtk.PopoverMenu()
    popovermenu.connect("closed", on_closed)
    popovermenu.set_size_request(100, 100)

    win.set_child(popovermenu)

    popovermenu.popup()
    win.present()


app = Gtk.Application(application_id='org.gtk.Example')
app.connect('activate', on_activate)
app.run(None)
```

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20250318
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2
Kernel Version: 6.13.6-1-default (64-bit)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to