mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 23:00:54 +00:00
events: don't hold events lock when dispatching free callbacks
The _event_timeout_remove and _event_handle_remove methods were holding onto the global lock when invoking the free callback. This is a violation of the libvirt events API contract which requires free callbacks to be invoked in a re-entrant safe context. Based on commit dd17c3cc587c73a8c915238f9d9a3e200e89c93f from libvirt-glib. Original author: Daniel P. Berrange <berrange@redhat.com> Related to: rhbz#1243228
This commit is contained in:
parent
d2c136b020
commit
0e0f021dec
@ -203,13 +203,11 @@ virt_viewer_events_cleanup_handle(gpointer user_data)
|
||||
g_debug("Cleanup of handle %p", data);
|
||||
g_return_val_if_fail(data != NULL, FALSE);
|
||||
|
||||
g_mutex_lock(eventlock);
|
||||
|
||||
if (data->ff)
|
||||
(data->ff)(data->opaque);
|
||||
|
||||
g_mutex_lock(eventlock);
|
||||
g_ptr_array_remove_fast(handles, data);
|
||||
|
||||
g_mutex_unlock(eventlock);
|
||||
|
||||
return FALSE;
|
||||
@ -382,13 +380,11 @@ virt_viewer_events_cleanup_timeout(gpointer user_data)
|
||||
g_debug("Cleanup of timeout %p", data);
|
||||
g_return_val_if_fail(data != NULL, FALSE);
|
||||
|
||||
g_mutex_lock(eventlock);
|
||||
|
||||
if (data->ff)
|
||||
(data->ff)(data->opaque);
|
||||
|
||||
g_mutex_lock(eventlock);
|
||||
g_ptr_array_remove_fast(timeouts, data);
|
||||
|
||||
g_mutex_unlock(eventlock);
|
||||
|
||||
return FALSE;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user