🐛 swu: protect against potential deadlock

If for some reason an exception gets thrown
inside get_current_versions that doesn't get
caught therein, `_get_versions_data_ready` will
never be set and thus any calls waiting for it
will block forever.

This patch fixes that by always setting the event
in the `finally` block.
This commit is contained in:
Gina Häußge committed 2023-01-25 17:52:44 +01:00
1 parent 13365e1f81
commit cc0f1e29f7
1 file changed
+1 -1
@@ -1766,9 +1766,9 @@ class SoftwareUpdatePlugin(
self._save_version_cache()
self._get_versions_data = information, update_available, update_possible
self._get_versions_data_ready.set()
finally:
self._get_versions_mutex.release()
self._get_versions_data_ready.set()
else: # something's already in progress, let's wait for it to complete and use its result
self._get_versions_data_ready.wait()