1

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

Community
  • 1
  • 1
Carson Ip
  • 1,896
  • 17
  • 27
  • Do you mean that Cinammon crashes, and not your app? The Cinammon process? Try starting it from the terminal, and see what it prints on crash then. – sashoalm Feb 17 '15 at 08:23
  • @sashoalm thanks for asking. There is no msg in terminal because the application is still working. Plz check update 2. – Carson Ip Feb 17 '15 at 08:36
  • 1
    No, I meant the Cinammon process. It is the one that crashes, not your app, right? What does it's STDOUT and STDERR say? Run Cinammon from the terminal. Kill the process and start it from the terminal - `killalll cinammon && cinammon`. – sashoalm Feb 17 '15 at 08:45
  • @sashoalm You're right. Since the system crashed and cannot recover in terminal, I can just take a photo. Here you are: http://i.imgur.com/wNO23Ox.jpg – Carson Ip Feb 17 '15 at 09:09
  • @sashoalm starting from "Window manager warning ..." – Carson Ip Feb 17 '15 at 09:09
  • Which lines were written after the you pressed the button (and not before)? Only the segmentation fault, or the 2 lines before that with "Window manager warning"? Also, add the relevant lines to your question, it will help people who search for the error on Google. – sashoalm Feb 17 '15 at 09:17
  • @sashoalm after pressing on the button, it appends from "Window manager warning ..." to seg fault. – Carson Ip Feb 17 '15 at 09:19
  • 1
    This is a bug in Cinammon itself. Regardless of what you do, a crash means a bug. You can file a bug report, but the problem is not in your own code. Sometimes official Linux programs are just buggy. To see extended info check /var/log/messages - http://serverfault.com/questions/518623/segfaults-are-not-logging-into-var-log-messages. I don't see what you can do short of fixing Cinammon. But fixing bugs in someone else's code is not easy, and it's a big project. – sashoalm Feb 17 '15 at 09:22

1 Answers1

0

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.

Carson Ip
  • 1,896
  • 17
  • 27