diff --git a/sleepyhead/SleepLib/machine.cpp b/sleepyhead/SleepLib/machine.cpp
index e09704a0..e164d07c 100644
--- a/sleepyhead/SleepLib/machine.cpp
+++ b/sleepyhead/SleepLib/machine.cpp
@@ -335,6 +335,8 @@ bool Machine::unlinkDay(Day * d)
bool Machine::unlinkSession(Session * sess)
{
+ MachineType mt = sess->type();
+
// Remove the object from the machine object's session list
bool b=sessionlist.remove(sess->session());
@@ -358,6 +360,10 @@ bool Machine::unlinkSession(Session * sess)
d = days.at(i);
if (d->sessions.removeAll(sess)) {
b=true;
+ if (!d->searchMachine(mt)) {
+ d->machines.remove(mt);
+ }
+
if (d->size() == 0) {
day.remove(dates[i]);
p_profile->unlinkDay(d);
diff --git a/sleepyhead/preferencesdialog.ui b/sleepyhead/preferencesdialog.ui
index f90e6ebf..97def644 100644
--- a/sleepyhead/preferencesdialog.ui
+++ b/sleepyhead/preferencesdialog.ui
@@ -9,7 +9,7 @@
0
0
- 809
+ 824
610
@@ -51,7 +51,7 @@
-
- 6
+ 0