[Qt-interest] Segfault when opening a QMessageBox::about
Andre Somers
andre at familiesomers.nl
Mon Mar 8 08:46:35 CET 2010
Bastiaan Naber wrote:
> Hi,
>
> I'm making an experimental application to see if I can use Qt with our
> research software. This software doesn't allow me to make threads or let
> someone hijack the main event loop. I have been able to intergrate Qt by
> creating a timer and calling:
>
> processEvents(); of QApplication
>
> every x mil seconds. This works fine and I have been able to create a window
> with some buttons on it. Even the Qt OpenGL example can be intergrate in this
> way.
>
> However I can't seem to open and QMessageBox-es by calling one of their static
> methods. When I try this my application segfaults somewhere in
> kernel_qwidget_x11.cpp:
>
> XSetWMProperties(dpy, id, 0, 0,
> qApp->d_func()->argv, qApp->d_func()->argc,
> &size_hints, &wm_hints, &class_hint);
>
> This is the statement that results in the crash:
>
> QMessageBox::about( this, "Example",
> "This example demonstrates simple use of Qt");
>
> Nothing spectacular I would say. This works offcourse if execute the Qt
> eventloop exec() but I really can't do this.
>
> Does anyone have any ideas about what is going on? I'm using Qt 4.6.2 on
> CentOS. I do have core dump if this helps.
I think what happens is that the message box *does* "hijack" the
eventloop. A modal messagebox, as will be created using the static
methods or using the ::exec method, creates it's own local eventloop.
That is probably now biting you...
André
More information about the Qt-interest-old
mailing list