Skip to content
Snippets Groups Projects
Commit 0e4c29f3 authored by Björn Beckendorf's avatar Björn Beckendorf
Browse files

BugFix: avioded deadlock

parent c78466a6
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.smd.financemanager</groupId>
<artifactId>SMD_KASSE</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.1</version>
<name>SMD Kasse</name>
<dependencies>
<dependency>
......
......@@ -157,9 +157,9 @@ public class BuchungsWrapper {
private void store() {
if (!storeEnabled)
return;
boolean valueResetRequired = false;
try {
storeMutex.acquire();
setStatus(EDIT);
try {
boolean newRow = buchung.getId() == -1;
......@@ -173,7 +173,7 @@ public class BuchungsWrapper {
buchung.setBank((Bank) bank.getSelectedItem());
buchung.store();
callbacktab.updateSaldo();
setValues();
valueResetRequired = true;
setStatus(OK);
if (newRow)
callbacktab.addNewBuchung();
......@@ -182,11 +182,18 @@ public class BuchungsWrapper {
}
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} finally {
storeMutex.release();
}
if (valueResetRequired) {
setValues();
}
}
private void setValues() {
try {
storeMutex.acquire();
storeEnabled = false;
setStatus(OK);
date.setText(buchung.getDate());
quittung.setText(buchung.getQuittung() == null || buchung.getQuittung() == 0 ? ""
......@@ -197,6 +204,11 @@ public class BuchungsWrapper {
kontoauszug.setText(buchung.getKontoauszug() == null || buchung.getKontoauszug() == 0 ? ""
: Integer.toString(buchung.getKontoauszug()));
bank.setSelectedItem(buchung.getBank());
storeEnabled = true;
storeMutex.release();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void setStatus(int status) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment