From eaf2b91a3db1d03e779de224a007813c1be4d7dc Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Thu, 14 May 2015 08:36:57 -0400 Subject: [PATCH] ecore-drm: Fix segfault if sending output event and output has no current mode Summary: This fixes a segfault which could happen if we enable an output before setting the output current mode. Now we test for an output having a current_mode, and if not we use the crtc size when sending the output event. @fix Signed-off-by: Chris Michael --- src/lib/ecore_drm/ecore_drm_output.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c index 276b74f100..3c2c04c6c8 100644 --- a/src/lib/ecore_drm/ecore_drm_output.c +++ b/src/lib/ecore_drm/ecore_drm_output.c @@ -42,13 +42,23 @@ _ecore_drm_output_event_send(const Ecore_Drm_Output *output, Eina_Bool plug) if (!(e = calloc(1, sizeof(Ecore_Drm_Event_Output)))) return; e->plug = plug; e->id = output->crtc_id; - e->w = output->current_mode->width; - e->h = output->current_mode->height; + + if (output->current_mode) + { + e->w = output->current_mode->width; + e->h = output->current_mode->height; + e->refresh = output->current_mode->refresh; + } + else if (output->crtc) + { + e->w = output->crtc->width; + e->h = output->crtc->height; + } + e->x = output->x; e->y = output->y; e->phys_width = output->phys_width; e->phys_height = output->phys_height; - e->refresh = output->current_mode->refresh; e->subpixel_order = output->subpixel; e->make = eina_stringshare_ref(output->make); e->model = eina_stringshare_ref(output->model);