GTK 窗口不会显示:[xcb] 处理队列时未知序列号

GTK 窗口不会显示:[xcb] 处理队列时未知序列号

我有一个 GTK4 应用程序 GTKConsole,它在另一个升级为 bookworm 的 Debian bullseye 系统上运行良好。我在另一台电脑上安装了新的书虫,无论是在 Wayland 还是 X 上,它都无法工作,而是引发以下错误:

Failed to create drawable
[xcb] Unknown sequence number while processing queue
[xcb] You called XInitThreads, this is not your fault
[xcb] Aborting, sorry about that
GTKConsole: ../../src/xcb_io.c:278: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed
Aborted

这是怎么回事?如何才能显示 GTK 窗口?该代码调用激活信号,该信号在不同的 debian bookworm 安装上运行:

static void activate (GtkApplication* app, gpointer user_data) {
    GtkWidget *lwindow;
    GtkWidget *rwindow;

    lwindow = gtk_application_window_new(app);
    rwindow = gtk_application_window_new (app);
    gtk_window_set_title (GTK_WINDOW (lwindow), "Left Panel");
    gtk_window_set_title (GTK_WINDOW (rwindow), "Right Panel");
    GdkDisplay * display; GListModel* monitors;
    
    display = gdk_display_get_default();
    monitors = gdk_display_get_monitors(display);
    GdkMonitor * monitor = (GdkMonitor *) g_list_model_get_item(monitors, 0);
    GdkMonitor * monitor2 = (GdkMonitor *) g_list_model_get_item(monitors, 1); //1 2 for 3 displays, 0 1 for 2
    
    GtkCssProvider * cssProvider = gtk_css_provider_new();
    gtk_css_provider_load_from_path(cssProvider, "styling.css");
    gtk_style_context_add_provider_for_display(gtk_widget_get_display(lwindow), GTK_STYLE_PROVIDER(cssProvider),
                                                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
    gtk_style_context_add_provider_for_display(gtk_widget_get_display(rwindow), GTK_STYLE_PROVIDER(cssProvider),
                                                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
    make_toggles(lwindow, (unsigned char) 0);
    make_toggles(rwindow, (unsigned char) 1);
    update_toggles();
    
    if (pthread_create(&thread_id, NULL, updateThread, NULL)) {
        log_perror("GTK could not create thread");
        exit(-1);
    }
    gtk_window_fullscreen_on_monitor(GTK_WINDOW(lwindow), monitor2);
    gtk_window_fullscreen_on_monitor(GTK_WINDOW(rwindow), monitor);
    //gtk_widget_show(lwindow); gtk_widget_show (rwindow); //deprecated as of gtk 4.10
    gtk_window_present(GTK_WINDOW(lwindow)); gtk_window_present(GTK_WINDOW(rwindow));
}

相关内容