Fix freeze on WebDAV automatic sync
Hi,
I've fixed the issue #177 (closed) opened by myself.
When the automatic update was triggered, gnote check for updates on the server. It ended up trying to call GvfsSyncService::mount_sync()
from the create_sync_server()
method of the GvfsSyncServiceAddin class from the main thread. This method is waiting for a condition variable to be notified from the lambda function passed as a callback to mount_async
which should be called by a lambda given to Gio::File::mount_enclosing_volume()
in the mount_async()
method.
That was never the case, because Gio::File::mount_enclosing_volume()
is putting the callback in the main loop's thread pool but the main loop is stuck waiting for the condition variable to be notified in mount_sync()
.
Thus, I had to free this main thread by using a thread for checking for updates and emit a Dispatcher signal if any. Don't know if that's the cleanest way to do it but I've tested it and no freeze happened at all.