fix calling of notifications. remove deadlock in 'eom_set_output_attribute' 55/81755/2
authorRoman Peresipkyn <r.peresipkyn@samsung.com>
Thu, 28 Jul 2016 07:28:49 +0000 (10:28 +0300)
committerRoman Peresipkyn <r.peresipkyn@samsung.com>
Thu, 28 Jul 2016 10:42:11 +0000 (13:42 +0300)
Cause of deadlock:
'eom_set_output_attribute' locks eom_mutex, then it calls eom wayland implementation 'eom_wayland_client_set_attribute' function. It sets attribute and waits for Enlightenment reply by invocation of 'wl_display_dispatch' and 'wl_display_roundtrip'. When client handles '_eom_wl_eom_output_attribute' it calls 'eom_wl_output->client_info->func' in the end, the func is '_eom_output_process_notify_cb'. '_eom_output_process_notify_cb' func is try to lock eom_mutex which is already locked by 'eom_set_output_attribute'.

Change-Id: I6bea2b765d2636e8766a8dd3077c6081e0cae5dd
Signed-off-by: Roman Peresipkyn <r.peresipkyn@samsung.com>
src/eom.c
src/wayland/eom-wayland.c

index 7ae9b09..2d5cf72 100755 (executable)
--- a/src/eom.c
+++ b/src/eom.c
@@ -1007,7 +1007,9 @@ eom_set_output_attribute(eom_output_id output_id,
        INFO("output_id: %d, attr: %d\n", output_id, attr);
 
 #ifdef HAVE_WAYLAND
+       _eom_mutex_unlock();
        ret_array = eom_wayland_client_set_attribute(output_id, attr);
+       _eom_mutex_lock();
 #else
        ret_array = eom_dbus_client_set_attribute(output_id, attr);
 #endif
index f709728..bb43799 100644 (file)
@@ -272,6 +272,7 @@ _eom_wayland_client_call_notify(EomWaylandOutput *eom_wl_output,
 {
        GArray *array = NULL;
        GValue v = G_VALUE_INIT;
+       int current_pid = getpid();
 
        array = g_array_new(FALSE, FALSE, sizeof(GValue));
 
@@ -327,7 +328,7 @@ _eom_wayland_client_call_notify(EomWaylandOutput *eom_wl_output,
 
        /* 8:pid */
        g_value_init(&v, G_TYPE_INT);
-       g_value_set_int(&v, eom_wl_output->physical_width);
+       g_value_set_int(&v, current_pid);
        array = g_array_append_val(array, v);
        g_value_unset(&v);
 
@@ -537,6 +538,7 @@ _eom_wl_eom_output_info(void *data,
        eom_wl_output->physical_width = w_mm;
        eom_wl_output->physical_height = h_mm;
        eom_wl_output->eom_status = connection;
+       eom_wl_output->client_info = &wl_client_info;
 
        wl_list_insert(&eom_client_info->eom_wl_output_list, &eom_wl_output->link);
 }
@@ -964,7 +966,9 @@ eom_wayland_client_set_window(eom_output_id output_id, Evas_Object *win)
                &wl_client_info.eom_wl_output_list, output_id);
        GOTO_IF_FAIL(eom_wl_output != NULL, fail);
 
+#if 0
        elm_win_aux_hint_add(win, "wm.policy.win.user.geometry", "1");
+#endif
 
        /* set full screen at output */
        xdg_shell_surface = ecore_wl_window_xdg_surface_get(e_wl_win);