Dear Geant4 maintainers, I am experiencing a segfault when exiting from the basic/B1 example. It is related to the usage of the QT5 environment. Most likely it is harmless (happens in derstructor of the QT viewer), but still would be good to resolve. I am using the latest Geant4.10.6.p02 reelase on Debian (testing). Below is the backtrace from gdb: Thread 1 "exampleB1" received signal SIGSEGV, Segmentation fault. 0x00007ffff0d9b734 in QOpenGLContext::makeCurrent(QSurface*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (gdb) bt #0 0x00007ffff0d9b734 in QOpenGLContext::makeCurrent(QSurface*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 #1 0x00007ffff19e3c29 in QGLContext::makeCurrent() () at /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 #2 0x00007ffff19e99d1 in QGLWidgetPrivate::makeCurrent() () at /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 #3 0x00007ffff7e41aab in G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() () at /usr/lib/geant4/libG4OpenGL.so #4 0x00007ffff7e423b0 in non-virtual thunk to G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() () at /usr/lib/geant4/libG4OpenGL.so #5 0x00007ffff09bd29e in QObjectPrivate::deleteChildren() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #6 0x00007ffff14d3ff6 in QWidget::~QWidget() () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #7 0x00007ffff1648ef9 in QStackedWidget::~QStackedWidget() () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #8 0x00007ffff09bd29e in QObjectPrivate::deleteChildren() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #9 0x00007ffff14d3ff6 in QWidget::~QWidget() () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #10 0x00007ffff7d88511 in G4QTabWidget::~G4QTabWidget() () at /usr/lib/geant4/libG4interfaces.so #11 0x00007ffff09bd29e in QObjectPrivate::deleteChildren() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #12 0x00007ffff14d3ff6 in QWidget::~QWidget() () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #13 0x00007ffff15eb1c9 in QMainWindow::~QMainWindow() () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #14 0x00007ffff09c04af in QObject::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #15 0x00007ffff14d8575 in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #16 0x00007ffff15eccb4 in QMainWindow::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #17 0x00007ffff1495ccf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #18 0x00007ffff149ee10 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #19 0x00007ffff0993d02 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #20 0x00007ffff0996494 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #21 0x00007ffff09eb273 in () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #22 0x00007fffef1bc5fd in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #23 0x00007fffef1bc880 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #24 0x00007fffef1bc90f in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #25 0x00007ffff09ea8ee in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #26 0x00007ffff099289b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #27 0x00007ffff099a672 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #28 0x00007ffff7d82169 in G4UIQt::SessionStart() () at /usr/lib/geant4/libG4interfaces.so #29 0x000055555555b0ae in main(int, char**) (argc=<optimized out>, argv=0x7fffffffd898) at /home/reznicek/tmp/g4/B1/exampleB1.cc:103 Thanks, Pavel
Hi Pavel Does this issue remain? I was hoping that someone using Debian would confirm this problem and provide more information. I am not in a position to test on Debian. On my platform (Mac) all's OK. The issue, as you say, is harmless. On the assumption that this issue will go away with newer versions of Geant4, Qt and Debian, I propose closing this bug report. John
Dear John, the issue still remains. It may be well bug in QT (v5.14.2). as well as in the way Geant4 calls the QT functions (e.g. too new version of QT?). If you would see any more info I could provide, I would be happy to. Otherwise waiting for new QT/Debian/Geant4 version is indeed the only thing we can do now. Best regards, Pavel
I have in problem as well, and for every Geant4 UI program. I suspect that something is improperly deleted (or not deleted, kinda depends). It is pretty harmless as it will only occur when closing the application and only in Gui mode. Also running Debian Sid.
Just for the record: the problem still persists even with updated QT version (5.15.2) and Geant4 version (10.7.p01).
Would I be right in saying this seems to be a Debian issue?
Well, there is no such problem in Debian stable (QT v5.11). So I would guess it is a problem of Geant4 compatibility with new QT version > ~5.14. I tried also CERN lxplus, but it has also old QT (v5.12). Test on latest Fedora could tell more, but I don't have access to such a machine. PS: It may also be a combination of the latest QT with the fact that my Geant4 is compiled with multithreading enabled. But it is a guess.
Hi Pavel > Just for the record: the problem still persists even with updated QT version (5.15.2) and Geant4 version (10.7.p01). > PS: It may also be a combination of the latest QT with the fact that my Geant4 is compiled with multithreading enabled. But it is a guess. Just to say...I'm on MacOS with Qt 5.15.0 and G4 10.7+ and all's OK. > Most likely it is harmless (happens in derstructor of the QT viewer), but still would be good to resolve. I don't think we have any Qt experts using Debian, so let's close this for now. Sorry. John
OK. Let's close that. PS: just found out it has been discussed also here: https://geant4-forum.web.cern.ch/t/qt5-opengl-segmentation-fault/3319/9, without resolution though...
Please don't close this just because there is no one able to fix it.
This has just occurred to me... How are you exiting your app? I too find a segfault (below) if I hit the window delete button but if I exit "cleanly" by typing "exit" in the command line window all is well. Thread 1: EXC_BAD_ACCESS (code=1, address=0x8) #0 0x00000001039c9477 in QOpenGLContext::makeCurrent(QSurface*) () #1 0x0000000102be0af4 in QGLContext::makeCurrent() () #2 0x0000000102be13f7 in QGLWidget::makeCurrent() () #3 0x0000000100aa0d7d in G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() at /Users/johna/Geant4/geant4-dev/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc:68
Ah, I can confirm this, when I exit by typing the command, I don't get a segfault as well.
OK. Progress. This is a long-standing issue. Even for plain X or Xm windows, hitting the delete button causes problems. We need to fix this (but it won't be top priority :-)