Changeset 787268f


Ignore:
Timestamp:
09/26/13 13:57:57 (12 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
565dbe4
Parents:
30e1ce9
Message:

Fix a seg fault when starting a replication that immediately fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/LPWatcher.cpp

    r8c6a630 r787268f  
    243243 
    244244void LPWatcher::startRepFileWatcher(){ 
    245   //qDebug() << "Start Rep File Watcher:" << FILE_REPLICATION; 
     245  qDebug() << "Start Rep File Watcher:" << FILE_REPLICATION; 
    246246  if(FILE_REPLICATION.isEmpty()){ return; } 
    247247 
    248248  if(watcher->files().contains(FILE_REPLICATION)){ return; } //duplicate - file already opened 
    249   else if(!watcher->files().isEmpty()){  
     249  /*else if(!watcher->files().isEmpty()){  
    250250    //Check that the file watcher is not already operating on a file 
    251251    // only one can be running at a time, so always cancel the previous instance (it is stale) 
     252    // *** WARNING - This causes seg fault for some reason**** 
    252253    QString tmp = FILE_REPLICATION; 
    253254    stopRepFileWatcher(); 
    254255    FILE_REPLICATION = tmp; 
    255   } 
     256  }*/ 
    256257  //Check to make sure that lpreserver actually has a process running before starting this 
    257258  //if(!QFile::exists("/var/run/<something.pid>"){ FILE_REPLICATION.clear(); return; } 
     
    263264  RFSTREAM = new QTextStream(repfile); 
    264265  watcher->addPath(FILE_REPLICATION); 
    265   //qDebug() << "Finished starting rep file watcher"; 
     266  qDebug() << "Finished starting rep file watcher"; 
    266267} 
    267268 
    268269void LPWatcher::stopRepFileWatcher(){ 
    269   //qDebug() << "Stop Rep File Watcher:" << FILE_REPLICATION; 
     270  qDebug() << "Stop Rep File Watcher:" << FILE_REPLICATION; 
    270271  if(FILE_REPLICATION.isEmpty()){ return; } 
    271272  watcher->removePath(FILE_REPLICATION); 
     273  //Close down the stream 
     274  RFSTREAM->setStatus(QTextStream::ReadPastEnd); //let any running process know to stop now 
     275  delete RFSTREAM;   
     276  //Close the file 
    272277  repfile->close(); 
    273   delete RFSTREAM; 
     278  //clear internal variables 
    274279  FILE_REPLICATION.clear(); 
    275280  repTotK.clear(); 
    276281  lastSize.clear(); 
    277   //qDebug() << "Finished stopping rep file watcher"; 
     282  qDebug() << "Finished stopping rep file watcher"; 
    278283} 
    279284 
Note: See TracChangeset for help on using the changeset viewer.