2017-12-20 Fred Gleason <fredg@paravelsystems.com>

* Added log locking logic to rdclilogedit(1).
This commit is contained in:
Fred Gleason
2017-12-20 11:24:30 -05:00
parent 28fbd59c4e
commit 941aece664
5 changed files with 50 additions and 1 deletions

View File

@@ -208,6 +208,10 @@ void MainObject::Load(QString logname)
delete edit_log_event;
edit_log_event=NULL;
}
if(edit_log_lock!=NULL) {
delete edit_log_lock;
edit_log_lock=NULL;
}
//
// Normalize log name case
@@ -223,6 +227,16 @@ void MainObject::Load(QString logname)
}
delete q;
QString username;
QString stationname;
QHostAddress addr;
edit_log_lock=new RDLogLock(logname,edit_user,edit_station,this);
if(!TryLock(edit_log_lock,logname)) {
delete edit_log_lock;
edit_log_lock=NULL;
return;
}
edit_log=new RDLog(logname);
if(edit_log->exists()) {
edit_log_event=new RDLogEvent(RDLog::tableName(logname));
@@ -555,5 +569,9 @@ void MainObject::Unload()
delete edit_log_event;
edit_log_event=NULL;
}
if(edit_log_lock!=NULL) {
delete edit_log_lock;
edit_log_lock=NULL;
}
edit_modified=false;
}