got rid of segmentation fault in update offfsets

This commit is contained in:
Dhanya Maliakal 2015-01-26 16:57:03 +01:00
parent a149d7fb2e
commit 36d6538104

View File

@ -102,6 +102,9 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
}
id--;
for (int id=0; id<MAXDET; id++) {
detectors[id]=NULL;
}
if (thisMultiDetector->alreadyExisting==0) {
@ -250,8 +253,8 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
// setAngularConversionPointer(detectors[i]->getAngularConversionPointer(),detectors[i]->getNModsPointer(),detectors[i]->getNChans()*detectors[i]->getNChips(), i);
}
for (int i=thisMultiDetector->numberOfDetectors; i<MAXDET; i++)
detectors[i]=NULL;
// for (int i=thisMultiDetector->numberOfDetectors; i<MAXDET; i++)
// detectors[i]=NULL;
@ -363,7 +366,7 @@ void multiSlsDetector::updateOffsets(){
thisMultiDetector->maxNumberOfChannel[Y] = 0;
//0th position
if (detectors[0]){
if ((detectors[0]) && (thisMultiDetector->numberOfDetectors > 0)){
offsetX = thisMultiDetector->offsetX[0] = 0;
offsetY = thisMultiDetector->offsetY[0] = 0;
numX = thisMultiDetector->numberOfChannel[X] = detectors[0]->getTotalNumberOfChannels(X);
@ -774,7 +777,6 @@ int multiSlsDetector::removeSlsDetector(int pos) {
return thisMultiDetector->numberOfDetectors;
//j=pos;
for (j=mi; j<ma; j++) {
if (detectors[j]) {
@ -784,9 +786,9 @@ int multiSlsDetector::removeSlsDetector(int pos) {
thisMultiDetector->maxNumberOfChannels-=detectors[j]->getMaxNumberOfChannels();
delete detectors[j];
detectors[j]=0;
thisMultiDetector->numberOfDetectors--;
if (single) {
for (int i=j+1; i<thisMultiDetector->numberOfDetectors+1; i++) {
@ -3943,11 +3945,11 @@ int multiSlsDetector::readConfigurationFile(string const fname){
//}
}
#ifdef VERBOSE
#ifdef VERBOSE
cout << endl;
for (int ia=0; ia<iargval; ia++) cout << args[ia] << " ??????? ";
cout << endl;
#endif
#endif
cmd=new multiSlsDetectorClient(iargval, args, PUT_ACTION, this);
delete cmd;
}