Search code examples
qtqt5x11cinnamon

Qt X11BypassWindowManagerHint open QFileDialog crash


I have a QMainWindow with windows flag set to be X11BypassWindowManagerHint. There is a QPushButton in the window triggering a QFileDialog. When the event is triggered, cinnamon will crash. When the flag is removed, there will be no crash. Please note that the window is required to always stay on top and that is why X11BypassWindowManagerHint is a must.

Any idea what is causing the crash? Not tested on other X11 systems / windows yet.

My config: Linux Mint 17.1 x64 with Cinnamon, Qt5.4

Many thanks!

Update 1: here's the code:

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
    ...
    Qt::WindowFlags flags = this->windowFlags();

    this->setWindowFlags(flags | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
    ...
    connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(openFileDialog()));
}

void MainWindow::openFileDialog(){
    QString file1Name = QFileDialog::getOpenFileName(this,
             tr("Open SRT File"), "/home", tr("SRT Files (*.srt)"));
    
}

Update 2: When it crashes, there will be a system dialog saying "Cinnamon just crashed. You are now running in fallback mode. Do you want to restart Cinnamon?" Please note that the application did not crash and exit. Instead, it is running, just not on top and not responding to UI interaction.

Update 3: Thanks to sashoalm's suggestion, I can now see the output of Cinnamon from terminal. After the button is pressed, terminal is appended with

Window manager warning: Log level 8: meta_window_unminimize: assertion '!window->override_redirect' failed

Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of - for 0x20000b7

Segmentation fault


Solution

  • Finally I found the answer to this. I must thank @sashoalm for leading me through the debugging process but I guess it is not exactly a bug of cinnamon.

    In the open file call: QFileDialog::getOpenFileName(this, tr("Open SRT File"), "/home", tr("SRT Files (*.srt)")); the problem is solved when I change this to 0. Probably a window with Qt::X11BypassWindowManagerHint cannot be a parent of a dialog.