Commit 1402c86b authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz
Browse files

Fix crash when the window disappears.

The redraw procedure was allowed to run after a window was destroyed.

Partially addresses #18
parent cca2a858
Pipeline #2417 passed with stage
in 55 seconds
......@@ -244,7 +244,7 @@ struct window {
int redraw_inhibited;
int redraw_needed;
int redraw_task_scheduled;
struct task redraw_task;
guint redraw_task;
int resize_needed;
int custom;
int focused;
......@@ -1590,7 +1590,10 @@ window_destroy(struct window *window)
struct window_output *window_output;
struct window_output *window_output_tmp;
wl_list_remove(&window->redraw_task.link);
if (window->redraw_task) {
g_source_remove(window->redraw_task);
window->redraw_task = 0;
}
wl_list_for_each(input, &display->input_list, link) {
if (input->touch_focus == window)
......@@ -3904,8 +3907,8 @@ void
window_inhibit_redraw(struct window *window)
{
window->redraw_inhibited = 1;
wl_list_remove(&window->redraw_task.link);
wl_list_init(&window->redraw_task.link);
g_source_remove(window->redraw_task);
window->redraw_task = 0;
window->redraw_task_scheduled = 0;
}
......@@ -4178,6 +4181,11 @@ surface_redraw(struct surface *surface)
return 0;
}
struct window_handle {
struct display* display;
struct window* window;
};
static gboolean
idle_redraw(void *data)
{
......@@ -4188,7 +4196,7 @@ idle_redraw(void *data)
DBG(" --------- \n");
wl_list_init(&window->redraw_task.link);
window->redraw_task = 0;
window->redraw_task_scheduled = 0;
if (window->resize_needed) {
......@@ -4238,7 +4246,7 @@ window_schedule_redraw_task(struct window *window)
return;
if (!window->redraw_task_scheduled) {
g_idle_add(idle_redraw, window);
window->redraw_task = g_idle_add(idle_redraw, window);
window->redraw_task_scheduled = 1;
}
}
......@@ -4839,7 +4847,6 @@ static struct window *
wl_surface_set_user_data(surface->surface, window);
wl_list_insert(display->window_list.prev, &window->link);
wl_list_init(&window->redraw_task.link);
wl_list_init (&window->window_output_list);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment