diff --git a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs index c98c2542..5b1d7bf7 100644 --- a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs +++ b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs @@ -1681,12 +1681,26 @@ impl UriPlaylistBin { } let element = self.obj(); + let mut notify_iteration = false; + let mut notify_index = false; + if current_iteration != state.current_iteration { state.current_iteration = current_iteration; - element.notify("current-iteration"); + notify_iteration = true; } if current_uri_index != state.current_uri_index { state.current_uri_index = current_uri_index; + notify_index = true; + } + + // drop mutex before notifying changes as the callback will likely try to fetch the updated values + // which would deadlock. + drop(state_guard); + + if notify_iteration { + element.notify("current-iteration"); + } + if notify_index { element.notify("current-uri-index"); } }