Problem 1772 - Visualisation with macro in batch
Summary: Visualisation with macro in batch
Status: RESOLVED DUPLICATE of problem 1667
Alias: None
Product: Geant4
Classification: Unclassified
Component: visualization/OpenGL (show other problems)
Version: 10.1
Hardware: All All
: P5 normal
Assignee: Laurent Garnier
URL:
Depends on:
Blocks:
 
Reported: 2015-07-28 12:23 CEST by garnier
Modified: 2016-01-28 17:59 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description garnier 2015-07-28 12:23:04 CEST
From visualization-g4hn@slac.stanford.edu (jan.pipek@gmail.com)

*** Discussion title: Visualization

Hi, I'd like to report a problem I am dealing the last few days with. It
may quite probable be a Qt bug, but anyway it happens when working with
Geant and may be relevant.

Scenario

 * /vis/open OGL in macro file (batch mode) (e.g. example B1, but
   tested for other examples with the same setting).
 * NOT occuring in an already started Qt GUI (interactive mode).

Where

 * Geant4 10.01.p02 AND 10.02.b01 (built from source with MT)
 * Fedora 22
 * gcc 5.1.1
 * Qt 5.4.2

What happens
Immediate core dump with the following gdb listing:

#0  0x00007ffff3af49f0 in QScreen::handle() const () at /lib64/libQt5Gui.so.5                                                                 
#1  0x00007fffe0f484c8 in QXcbWindow::setParent(QPlatformWindow const*) () at /usr/lib64/qt5/plugins/platforms/libqxcb.so                     
#2  0x00007ffff3ad575c in QWindow::setParent(QWindow*) () at /lib64/libQt5Gui.so.5                                                            
#3  0x00007ffff42a9d05 in QWidgetPrivate::setParent_sys(QWidget*, QFlags) () at /lib64/libQt5Widgets.so.5                     
#4  0x00007ffff42b4bca in QWidget::setParent(QWidget*, QFlags) () at /lib64/libQt5Widgets.so.5                                
#5  0x00007ffff42b5b4c in QWidget::setParent(QWidget*) () at /lib64/libQt5Widgets.so.5                                                        
#6  0x00007ffff429184b in QLayout::addChildWidget(QWidget*) () at /lib64/libQt5Widgets.so.5                                                   
#7  0x00007ffff42971bc in QStackedLayout::insertWidget(int, QWidget*) () at /lib64/libQt5Widgets.so.5                                         
#8  0x00007ffff4416b76 in QTabWidget::insertTab(int, QWidget*, QIcon const&, QString const&) () at /lib64/libQt5Widgets.so.5                  
#9  0x00007ffff4416c44 in QTabWidget::insertTab(int, QWidget*, QString const&) () at /lib64/libQt5Widgets.so.5                                
#10 0x00007ffff6c00065 in G4UIQt::AddTabWidget(QWidget*, QString) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4interfaces.so             
#11 0x00007ffff709f80b in G4OpenGLQtViewer::CreateMainWindow(QGLWidget*, QString const&) ()                                                   
   at /home/honza/opt/geant4.10.01.p02/lib64/libG4OpenGL.so                                                                                  
#12 0x00007ffff70a26a7 in G4OpenGLStoredQtViewer::Initialise() () at /home/honza/opt/geant4.10.01.p02/lib64/libG4OpenGL.so                    
#13 0x00007ffff56d0aac in G4VisManager::CreateViewer(G4String const&, G4String const&) ()
   at /home/honza/opt/geant4.10.01.p02/lib64/libG4vis_management.so
#14 0x00007ffff56af827 in G4VisCommandViewerCreate::SetNewValue(G4UIcommand*, G4String) ()
   at /home/honza/opt/geant4.10.01.p02/lib64/libG4vis_management.so
#15 0x00007fffefa43332 in G4UIcommand::DoIt(G4String) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#16 0x00007fffefa5ab17 in G4UImanager::ApplyCommand(char const*) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#17 0x00007ffff5674908 in G4VisCommandOpen::SetNewValue(G4UIcommand*, G4String) ()
   at /home/honza/opt/geant4.10.01.p02/lib64/libG4vis_management.so
#18 0x00007fffefa43332 in G4UIcommand::DoIt(G4String) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#19 0x00007fffefa5ab17 in G4UImanager::ApplyCommand(char const*) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#20 0x00007fffefa3323d in G4UIbatch::ExecCommand(G4String const&) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#21 0x00007fffefa34933 in G4UIbatch::SessionStart() () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
---Type  to continue, or q  to quit---
#22 0x00007fffefa5c952 in G4UImanager::ExecuteMacroFile(char const*) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#23 0x00007fffefa4d4ac in G4UIcontrolMessenger::SetNewValue(G4UIcommand*, G4String) ()
   at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#24 0x00007fffefa43332 in G4UIcommand::DoIt(G4String) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#25 0x00007fffefa5ab17 in G4UImanager::ApplyCommand(char const*) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#26 0x00007fffefa3323d in G4UIbatch::ExecCommand(G4String const&) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#27 0x00007fffefa34933 in G4UIbatch::SessionStart() () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#28 0x00007fffefa5c952 in G4UImanager::ExecuteMacroFile(char const*) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#29 0x00007fffefa4d4ac in G4UIcontrolMessenger::SetNewValue(G4UIcommand*, G4String) ()
   at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#30 0x00007fffefa43332 in G4UIcommand::DoIt(G4String) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#31 0x00007fffefa5ab17 in G4UImanager::ApplyCommand(char const*) () at /home/honza/opt/geant4.10.01.p02/lib64/libG4intercoms.so
#32 0x0000000000415747 in main ()

Probable cause
QScreen::handle() crashes unless there is a visible main window (hard to
say whether it is a bug or a feature of Qt).

How to avoid
Two options (both just workarounds):

 1 start GUI session and THEN run all what is in the macro
 2 Hard-code visibility of the window like this:

   G4UIQt* qui = static_cast<G4UIQt*> (UImanager->GetG4UIWindow());
   if (qui) {
     qui->GetMainWindow()->setVisible(true);
   }

    While I am able to use either solution for my needs, I think the
problem is worth mentioning (even if it were relevant for a few Fedora
users) and/or fixing in the next release (if it reproduces in other
systems with recent Qt's). 
Happy geant4'ing, Jan
Comment 1 garnier 2015-10-05 09:19:30 CEST
Probably same bug as #1667. See for details.
Comment 2 Laurent Garnier 2015-10-05 09:21:44 CEST
Probably same bug as #1667. See for details.
Comment 3 Laurent Garnier 2016-01-28 17:59:57 CET

*** This problem has been marked as a duplicate of problem 1667 ***