From: san Date: Mon, 20 Mar 2006 13:48:07 +0000 (+0000) Subject: Compilation and run-time problems on Win32: mutex initialization, copy-paste errors X-Git-Tag: LAST_STABLE_VERSION_21_09_2006_ON_3_2_0~66 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a6b64dddab50a942260f180499746e57b4b2bf43;p=modules%2Fkernel.git Compilation and run-time problems on Win32: mutex initialization, copy-paste errors --- diff --git a/src/Basics/BasicsGenericDestructor.cxx b/src/Basics/BasicsGenericDestructor.cxx index 91585a2ae..aefed245c 100644 --- a/src/Basics/BasicsGenericDestructor.cxx +++ b/src/Basics/BasicsGenericDestructor.cxx @@ -37,7 +37,12 @@ using namespace std; void HouseKeeping(); std::list PROTECTED_DELETE::_objList; +#ifndef WNT pthread_mutex_t PROTECTED_DELETE::_listMutex; +#else +pthread_mutex_t PROTECTED_DELETE::_listMutex = + PTHREAD_MUTEX_INITIALIZER; +#endif std::list *GENERIC_DESTRUCTOR::Destructors = 0; static bool atExitSingletonDone = false ; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx index 4d8bb5546..24f624ec7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx @@ -297,6 +297,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRow(int theRow) } else { SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]); } @@ -366,6 +367,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetColumn(int theColumn) } else { SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); } return aVector; @@ -433,6 +435,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowSetIndices(int theRow) else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx index bb7cf1f26..5ba240125 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx @@ -296,6 +296,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRow(int theRow) } else { SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]); } @@ -365,6 +366,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetColumn(int theColumn) } else { SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); } return aVector; @@ -430,6 +432,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowSetIndices(int theRow) } else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx index 8511dac23..e0162cdfb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx @@ -71,8 +71,10 @@ std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get() else { SALOMEDS::Study::ListOfSObject_var aSeq = SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Get(); aLength = aSeq->length(); - aSO = new SALOMEDS_SObject(aSeq[i].in()); - for (i = 0; i < aLength; i++) aVector.push_back(_PTR(SObject)(aSO)); + for (i = 0; i < aLength; i++) { + aSO = new SALOMEDS_SObject(aSeq[i].in()); + aVector.push_back(_PTR(SObject)(aSO)); + } } return aVector; diff --git a/src/SALOMELocalTrace/BaseTraceCollector.cxx b/src/SALOMELocalTrace/BaseTraceCollector.cxx index de6121897..88eccb51d 100644 --- a/src/SALOMELocalTrace/BaseTraceCollector.cxx +++ b/src/SALOMELocalTrace/BaseTraceCollector.cxx @@ -37,7 +37,12 @@ using namespace std; // Class attributes initialisation, for class method BaseTraceCollector::run BaseTraceCollector* BaseTraceCollector::_singleton = 0; +#ifndef WNT pthread_mutex_t BaseTraceCollector::_singletonMutex; +#else +pthread_mutex_t BaseTraceCollector::_singletonMutex = + PTHREAD_MUTEX_INITIALIZER; +#endif sem_t BaseTraceCollector::_sem; int BaseTraceCollector::_threadToClose = 0; pthread_t* BaseTraceCollector::_threadId = 0; // used to control single run diff --git a/src/SALOMELocalTrace/LocalTraceCollector.cxx b/src/SALOMELocalTrace/LocalTraceCollector.cxx index edaa24690..cf9bd9bde 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.cxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.cxx @@ -56,9 +56,8 @@ BaseTraceCollector* LocalTraceCollector::instance() sem_init(&_sem,0,0); // to wait until run thread is initialized pthread_t traceThread; - int bid; int re2 = pthread_create(&traceThread, NULL, - LocalTraceCollector::run, (void *)bid); + LocalTraceCollector::run, NULL); sem_wait(&_sem); _singleton = myInstance; // _singleton known only when init done }