r578: no message
[ctsim.git] / src / backgroundmgr.cpp
index ee789deb155b0128914c7f259a24c42b9c8cda9e..b6d0bd66d0091744e88e79f324da91fdf02638c8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.cpp,v 1.5 2001/02/23 21:58:31 kevin Exp $
+**  $Id: backgroundmgr.cpp,v 1.6 2001/02/25 06:32:12 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -35,7 +35,7 @@
 #include "ctsim.h"
 #include "docs.h"
 #include "views.h"
-#include "threadrecon.h"
+#include "backgroundsupr.h"
 #include "backgroundmgr.h"
 
 
@@ -141,7 +141,11 @@ BackgroundManager::OnAddTask (wxCommandEvent& event)
   m_iNumTasks++;
 
   resizeWindow();
-  Show(true);
+  if (m_iNumTasks == 1) {
+    theApp->getMainFrame()->SetFocus();  // necessary to keep wxWindows from crashing
+    Show(true);  
+    theApp->getMainFrame()->SetFocus();  // necessary to keep wxWindows from crashing
+  }
 }
 
 void
@@ -197,6 +201,8 @@ BackgroundManager::lookupGauge (BackgroundSupervisor* pTask)
 {
   wxGauge* pGauge = NULL;
   int i = 0;
+
+  wxCriticalSectionLocker locker (m_criticalSection);
   for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) {
     if (*iTask == pTask) {
       pGauge = m_vecpGauges[i];