Hello,
I was wondering if it would be possible to change the behavior of
TRint::Run(Bool_t retrn) when retrn=kTRUE and the TRint object was created
with the "-q" option so that TApplication::QuitOpt() is true. Right now
the result is that under these conditions a call to:
TRint::Run(kTRUE)
will exit the program via exit(0), which means that objects still
in existence will not be deleted before exiting the program. Please see
the example program below. I am using ROOT 3.01/03, 25 May 2001.
Specifically, the change I would like is in the following lines of code in
TRint.cxx:
void TRint::Run(Bool_t retrn)
{
...
// if (QuitOpt())
// Terminate(0);
// Changed to:
//
if (QuitOpt()) {
if (retrn == kTRUE) return
Terminate(0);
}
//
// And likewise a few lines down prior to Terminate(0)
//
}
I'll attach a simple test program which demonstrates this behavior:
//=== begin test program
#include <iostream>
#include "TROOT.h"
#include "TRint.h"
class DeleteMe
{
public:
DeleteMe() { cerr << "vvvvv Object Created vvvvv\n"; }
~DeleteMe() { cerr << "^^^^^ Object Deleted ^^^^^\n"; }
};
int main(int argc, char** argv) {
TROOT troot("troot","troot");
TRint* app = new TRint("app",&argc,argv,0,0,kTRUE);
DeleteMe x;
app->Run(kTRUE);
return 0;
}
//=== end test program
heplminos2% g++ example.cxx `root-config --cflags --libs`
heplminos2% ./a.out
vvvvv Object Created vvvvv
root [0] .q
root [1] ^^^^^ Object Deleted ^^^^^
heplminos2% ./a.out -q
vvvvv Object Created vvvvv
root [0]
Notice that the second case using the -q option has no message indicating
that the object x was deleted. However, I think these two cases should
behave identically.
Thank you,
Mark
========================================================================
Mark Messier e-mail: messier@huhepl.harvard.edu
Harvard University http://www.hepl.harvard.edu/~messier
42 Oxford Street Tel. (617) 496-2361
Cambridge, MA 02138
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:47 MET