Re: BROP-1-0-1 and something must be wrong here.......

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Sun Jul 15 2001 - 08:34:38 EDT

  • Next message: Kris Hagel: "Re: BROP-1-0-1 and something must be wrong here......."

    Hi Jens Ivar et al, 
    
    On Sat, 14 Jul 2001 00:12:10 -0100 (GMT+1)
    Jens Ivar Jordre <jens@fi.uib.no> wrote
    concerning ": Re: BROP-1-0-1 and something must be wrong here.......":
    > On Fri, 13 Jul 2001, Christian Holm Christensen wrote:
    > 
    > > > The dialog, PrintDialogBox, inherits from TGTransientFrame and is
    > > > constructed with "new PrintDialogBox(<arguments>)".
    > >
    > > Hmm.  Odd.  How is the window unmapped?  Does the "Ok", "Cancel",
    > > ladida button delete the object it self?  I believe it should (see
    > > also guitest.C in the ROOT source tree).
    > 
    > Comparing with guitest.C and especially its TestMsgBox, they are
    > strikingly similar. They both call their overwritten CloseWindow() member
    > function that is simply "delete this;". However, one class works
    > flawlessly and the other one doesn't.
    > 
    > You can have a look yourself in
    > <your_brop_dir>/monitor/abc/BrPrintManager.cxx:
    > PrintDialogBox::SetupWindow
    
    Do you delete _all_ allocated objects in the DTOR, in particular also
    the TGGC ojects?  I really don't want to go through all that code. 
    
    > > I really REALLY recoomend using the signal/slot thing instead, since
    > > it is soooo much nicer and easier to understand.
    > 
    > Any documentation references?
    
    See 
    
     http://root.cern.ch/root/HowtoSignalSlot.html
     http://root.cern.ch/root/html/TQObject.html
     http://root.cern.ch/lxr/source/tutorials/guitest.C
    
    Maybe there's also somthing in the user's guide, but I don't know.  
    
    I've made a sketch of a DB browser, which uses the signal/slot thing.
    I'll try to remember to bring it in tomorrow, and I'll send it to
    you, or put it on AFS or something. 
    
    > Yes, apparently I did "gdb supermon" on the binary generated with
    > "make" (not "make install") and got the error message:
    > 
    > "/home/bergen/jens/brahms/brop/monitor/apps/supermon": not in executable
    > format: File format not recognized.
    
    /home/bergen/jens/brahms/brop/monitor/apps/supermon is a script. 
     
    > However, when I run gdb with the binary created with "make install" it
    > works fine.
    
    To debug an application in the source directory do: 
    
      libtool gdb monitor/apps/supermon 
    
    > So, the output from gdb indcates that it is the resizing of the printer
    > dialog that causes trouble:
    > 
    > % gdb supermon
    > 
    > ....supermon initialization output.....
    > 
    > root [0] Trying to print, fPrintManager = 145062992
    > Trying to print, fPrintManager = 145062992
    > 
    > Program received signal SIGSEGV, Segmentation fault.
    > 0x40ca5dab in TGHorizontalLayout::GetDefaultSize () from /afs/rhic/opt/brahms/root/root_v3.00.06/lib/libGui.so
    > Current language:  auto; currently c
    > (gdb) bt
    > #0  0x40ca5dab in TGHorizontalLayout::GetDefaultSize () from /afs/rhic/opt/brahms/root/root_v3.00.06/lib/libGui.so
    > #1  0x40c9fe03 in TGCompositeFrame::GetDefaultSize () from /afs/rhic/opt/brahms/root/root_v3.00.06/lib/libGui.so
    
    ... 
    
    > #8  0x41548fed in PrintDialogBox::SetupWindow (this=0x9244f00, main=0x8a2f210) at BrPrintManager.cxx:338
    > #9  0x415478aa in PrintDialogBox::PrintDialogBox (this=0x9244f00, p=0x89a9550, main=0x8a2f210, w=400, h=200, options=3, info=0x8a57c78, ret_stat=0xbffff0fc)
    >     at BrPrintManager.cxx:132
    
    The absolute last thing in SetupWindow should be 
    
      MapSubwindows();
      Resize(GetDefaultSize());
      MapWindow();
    
    i.e., you should not set up anything after that.  I don't think that's
    what is causeing the SIGSEGV, but it's really what you should do.  
    
    Maybe you should try to compile ROOT with --build=debug and then step
    through to see what illegal memory you're trying to dereference. 
    
    > Here a print dialog is opened successfully for the first histogram to be
    > printed, giving the first "Trying to print....." line at stdout. When the
    > second histogram is to be printed the seg.violation occurs.
    
    An alternative to deleting the object,  is to unmap it like
    UnmapWindow, and when the window is needed again, map it with
    MapSubWindows, Resize, MapWindow.  Ofcourse you have to protect
    against the user hitting M-F4 or closing the window using the window
    manager.  This is really easy using signals and slots BTW. 
    
    
    > > If you want to avoid this optimisation, configure the source tree as
    > >
    > >   CXXFLAGS="-g" ./configure <options>
    > 
    > That's the bash way of doing it. How about csh and its decendants? Maybe
    > your proposed arguments to configure (below) should be included right
    > away.
    
    I don't know - I don't like CSH - switch to bash :-) if only
    temporarily :-( 
     
    > >   ./configure --disable-optimisation
    > >   ./configure --disable-debug
    
    These are in BRAT now.  It's straight forward to also include them in
    BROP.  Copy brat/config/debug.m4 to brop/config/, edit the toplevel
    Makefile.am so that EXTRA_DIST contains config/debug.m4, and edit
    configure.in to contain AC_DEBUG and AC_OPTIMISATION.  Look at the
    corresponding files in BRAT. 
    
    Yours, 
    
    Christian  -----------------------------------------------------------
    Holm Christensen                             Phone:  (+45) 35 35 96 91 
      Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
      DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
      Denmark                                    Email:       cholm@nbi.dk
    



    This archive was generated by hypermail 2b30 : Sun Jul 15 2001 - 08:35:30 EDT