I have an app that I can move between X11 displays, but when I'm on a display other than where I started, attempting to open a popup menu causes a crash. Menus in the menubar work fine, it's just the popup that doesn't.
(popuptest.pl:17147): Gdk-ERROR **: The program 'popuptest.pl' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 355 error_code 3 request_code 131 minor_code 51)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap (core dumped)
I created a simple test case that reproduces the problem:
Xvnc :1, etc.)vncviewer :1)Sample code:
#!/usr/bin/perl -w
use strict;
use Glib qw/TRUE FALSE/;
use Gtk3 -init;
my $win = Gtk3::Window->new;
$win->signal_connect(destroy => sub {Gtk3::main_quit});
my $btn = Gtk3::Button->new_with_label("move to :1");
$btn->signal_connect(clicked => sub {
$win->set_screen(Gtk3::Gdk::Display::open(":1")->get_screen(0));
});
my $menu;
$btn->signal_connect('button-press-event' => sub {
my ($widget, $event) = @_;
return FALSE unless $event->button == 3;
$menu = Gtk3::Menu->new;
$menu->attach(Gtk3::MenuItem->new_with_label(''.localtime), 0, 1, 0, 1);
$menu->show_all;
$menu->popup(undef, undef, undef, undef, $event->button, $event->time);
return TRUE;
});
$win->add($btn);
$win->show_all;
Gtk3->main;
Versions:
It appears to be a bug in that version of Gtk.
I was able to test it on a system with Gtk 3.18 and it works fine. At least I know it's not a bug in the Perl code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With