Skip to content

Commit

Permalink
onUnitNew is triggered with every property check.
Browse files Browse the repository at this point in the history
If the systemd unit doesn't exist, the call systemdServiceIface.getProperty
creates a temporary systemd unit, which triggers onUnitNew.
This results in a loop that causes the issue.

Fixes #439
  • Loading branch information
jmlich committed Dec 24, 2024
1 parent 0665a8d commit 9e41761
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions ui/qml/harbour-amazfish.qml
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,9 @@ ApplicationWindowPL
function updateProperties() {
if (ENABLE_SYSTEMD === "YES"){
var activeProperty = systemdServiceIface.getProperty("ActiveState");
if (activeProperty === "active") {
serviceActiveState = true;
} else {
serviceActiveState = false;
}

serviceActiveState = (activeProperty === "active");
var serviceEnabledProperty = systemdServiceIface.getProperty("UnitFileState");
if (serviceEnabledProperty === "enabled") {
serviceEnabledState = true;
}
else {
serviceEnabledState = false;
}
serviceEnabledState = (serviceEnabledProperty === "enabled");
}
}

Expand All @@ -147,7 +137,8 @@ ApplicationWindowPL
signal unitNew(string name)
onUnitNew: {
if (name == "harbour-amazfish.service" && ENABLE_SYSTEMD === "YES") {
systemdServiceIface.updateProperties()
// systemd unit is created every time when doesn't exists, hence this leads to recursion
// systemdServiceIface.updateProperties()
}
}

Expand Down

0 comments on commit 9e41761

Please sign in to comment.