Skip to content

Commit 68c455d

Browse files
authored
Merge pull request #3426 from ControlSystemStudio/info_dialog_fix
Fix potential PV leak
2 parents 2189d66 + 6908a32 commit 68c455d

File tree

1 file changed

+7
-2
lines changed
  • app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx

1 file changed

+7
-2
lines changed

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/WidgetInfoDialog.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,14 +658,19 @@ private ArchivedStatus getFromArchiver(String pvName) {
658658
}
659659
// Prepend "archiver://"
660660
pvName = "archive://" + pvName + "(" + TimestampFormats.SECONDS_FORMAT.format(Instant.now()) + ")";
661+
PV pv = null;
661662
try {
662-
PV pv = PVPool.getPV(pvName);
663+
pv = PVPool.getPV(pvName);
663664
VType pvValue = pv.read();
664-
PVPool.releasePV(pv);
665665
return pvValue == null ? ArchivedStatus.NO : ArchivedStatus.YES;
666666
} catch (Exception e) {
667667
return ArchivedStatus.UNKNOWN;
668668
}
669+
finally {
670+
if(pv != null){
671+
PVPool.releasePV(pv);
672+
}
673+
}
669674
}
670675

671676
private enum ArchivedStatus {

0 commit comments

Comments
 (0)