Comment 31 for bug 1794292

Gert van de Kraats (gkraats) wrote :

Same problem as described before.
To force I use timeout 1 and theme fade-in. But same problem also occurred at my PC with the default timeout 5, as was on the trace.
I will upload the crashdump (which by default was ignored by apport).
Routine ply_renderer_free does a hard free of renderer. So renderer cannot be referenced later at deactivation of keyboard, because the memory might be overwritten.
I wrote a routine which shlould be called before ply_renderer_free:
void
ply_device_manager_deactivate_keyboard (ply_device_manager_t *manager,
                            ply_renderer_t *renderer)
{
        ply_list_node_t *node;

        node = ply_list_get_first_node (manager->keyboards);
        while (node != NULL) {
                ply_keyboard_t *keyboard;
                ply_list_node_t *next_node;

                keyboard = ply_list_node_get_data (node);
                next_node = ply_list_get_next_node (manager->keyboards, node);
                if (ply_keyboard_get_renderer (keyboard) == renderer) {
                        ply_trace ("deactivating keyboard");
                        ply_keyboard_stop_watching_for_input (keyboard);
                        ply_list_remove_node (manager->keyboards, node);
                        break;
                }
                node = next_node;
        }

}

At ply-keyboard.c:
c
ply_renderer_t *
ply_keyboard_get_renderer (ply_keyboard_t *keyboard)
{
        assert (keyboard != NULL);
        return keyboard->provider.if_renderer->renderer;
}