diff --git a/src/common/db.cpp b/src/common/db.cpp index be855ba25c..f362566854 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -65,7 +65,9 @@ wxChar const *SQL_CATALOG_FILENAME = wxT("catalog.txt"); #include "wx/thread.h" extern wxList TablesInUse; +#if wxUSE_THREADS extern wxCriticalSection csTablesInUse; +#endif // wxUSE_THREADS #endif // SQL Log defaults to be used by GetDbConnection @@ -1750,7 +1752,9 @@ void wxDb::Close(void) #ifdef __WXDEBUG__ { +#if wxUSE_THREADS wxCriticalSectionLocker lock(csTablesInUse); +#endif // wxUSE_THREADS wxTablesInUse *tiu; wxList::compatibility_iterator pNode; pNode = TablesInUse.GetFirst(); diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index 423c1b5a98..169a424061 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -62,7 +62,9 @@ ULONG lastTableID = 0; #include "wx/thread.h" wxList TablesInUse; +#if wxUSE_THREADS wxCriticalSection csTablesInUse; +#endif // wxUSE_THREADS #endif @@ -199,7 +201,9 @@ bool wxDbTable::initialize(wxDb *pwxDb, const wxString &tblName, const UWORD num tableInUse->tableID = tableID; tableInUse->pDb = pDb; { +#if wxUSE_THREADS wxCriticalSectionLocker lock(csTablesInUse); +#endif // wxUSE_THREADS TablesInUse.Append(tableInUse); } #endif @@ -328,7 +332,9 @@ void wxDbTable::cleanup() wxList::compatibility_iterator pNode; { +#if wxUSE_THREADS wxCriticalSectionLocker lock(csTablesInUse); +#endif // wxUSE_THREADS pNode = TablesInUse.GetFirst(); while (!found && pNode) {