Message: segment fault when exitting Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question segment fault when exitting 

Keywords: state management
Forum: Run Management
Date: 27 Oct, 2004
From: luhao <luhao>

Hello!
    I am trying to test the 'state hook' in geant4 when it shifts its
state. I modified novice/exampleN01 as:
1. add file Ex01IdleHook.hh:
     #include "G4VStateDependent.hh"
     #include "G4Types.hh"
     #include "G4ios.hh"
    class UserHookForIdle: public G4VStateDependent
           {
             public:
             UserHookForIdle();
             ~UserHookForIdle();
             G4bool Notify(G4ApplicationState);
           };
2. add file Ex01IdleHook.cc
    #include "ExN01IdleHook.hh"
    #include "G4RunManager.hh"
    UserHookForIdle::UserHookForIdle(){;}
    UserHookForIdle::~UserHookForIdle(){;}
    G4bool UserHookForIdle::Notify(G4ApplicationState required)
     {
       if(required!=G4State_Idle) return true;
       G4cout<<"idle state detected!"<<G4endl;
       return true;
     }

3. modify exampleN01.cc:

  #include "ExN01IdleHook.hh"
      // Initialize G4 kernel
      runManager->Initialize();
      UserHookForIdle myhook;
      // get the pointer to the UI manager and set verbosities
      //  G4UImanager* UI = G4UImanager::GetUIpointer();
      //  UI->ApplyCommand("/run/verbose 1");
      //   UI->ApplyCommand("/event/verbose 1");
      //   UI->ApplyCommand("/tracking/verbose 1");

      // start a run
      //      int numberOfEvent = 3;
      //  runManager->BeamOn(numberOfEvent);
      G4UIsession* session=new G4UIterminal(new G4UItcsh);
      session->SessionStart();    
      delete session;

Everything works well before the program exits. When I execute "/run/beamOn 1", the program 
print "idle state detected" just I want it to be. But when I run: "exit", I get a segment fault. That happens before 
"delete runManger" in the exampleN01.cc
the error message is as follow:
*** Break *** segmentation violation
 Generating stack trace...
/usr/bin/addr2line: single: No such file or directory
/usr/bin/addr2line: single: No such file or directory
 0x432614d6 in __libc_free + 0x86 from /lib/tls/libc.so.6
 0x431bc983 in operator delete(void*) + 0x23 from /usr/lib/libstdc++.so.5
 0x4001adb4 in UserHookForIdle::~UserHookForIdle [in-charge deleting]() + 0x30 from /home/gh/geant4.6.1/tmp/Linux-g++/single/libsingle.so
 0x416e519a in G4StateManager::~G4StateManager [in-charge]() + 0x8c from /home/gh/geant4.6.1/lib/Linux-g++/libG4globman.so
 0x412d99b4 in G4RunManagerKernel::~G4RunManagerKernel [in-charge deleting]() + 0x168 from /home/gh/geant4.6.1/lib/Linux-g++/libG4run.so
 0x412dc091 in G4RunManager::~G4RunManager [in-charge deleting]() + 0x1af from /home/gh/geant4.6.1/lib/Linux-g++/libG4run.so
 0x08049c94 in main + 0x290 from single
 0x43203574 in __libc_start_main + 0xe4 from /lib/tls/libc.so.6
 0x08049975 in operator new(unsigned) + 0x31 from single

I tested it both in RH7.3 & in RH9.0

can anyone help me out? thank you very much!

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: segment fault when exitting   (Makoto Asai - 07 Mar, 2005)
 Add Message Add Message
to: "segment fault when exitting"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]