1.1 --- a/src/simulator/simulator.cc Tue May 06 12:20:10 2008 -0700
1.2 +++ b/src/simulator/simulator.cc Wed May 07 11:33:40 2008 -0700
1.3 @@ -428,6 +428,12 @@
1.4 {
1.5 if (m_priv == 0)
1.6 {
1.7 + /* Note: we call LogSetTimePrinter below _after_ calling CreateObject because
1.8 + * CreateObject can trigger calls to the logging framework which would call
1.9 + * the TimePrinter function above which would call Simulator::Now which would
1.10 + * call Simulator::GetPriv, and, thus, get us in an infinite recursion until the
1.11 + * stack explodes.
1.12 + */
1.13 m_priv = CreateObject<SimulatorPrivate> ();
1.14 Ptr<Scheduler> scheduler = CreateObject<MapScheduler> ();
1.15 m_priv->SetScheduler (scheduler);
1.16 @@ -444,6 +450,11 @@
1.17 {
1.18 return;
1.19 }
1.20 + /* Note: we have to call LogSetTimePrinter (0) below because if we do not do this,
1.21 + * and restart a simulation after this call to Destroy, (which is legal),
1.22 + * Simulator::GetPriv will trigger again an infinite recursion until the stack
1.23 + * explodes.
1.24 + */
1.25 LogSetTimePrinter (0);
1.26 m_priv->Destroy ();
1.27 m_priv = 0;