framebuffer: check we have a draw/read_buffer before freeing
When freeing a framebuffer stack it's possible to have entries with NULL draw or read buffers so we should check that before calling cogl_onscreen/offscreen_free. This fixes a crash with the wayland backend when running conformance tests such as cogl-test-object which never push a framebuffer.
This commit is contained in:
parent
2282455f27
commit
89e46a472f
@ -1102,15 +1102,21 @@ _cogl_free_framebuffer_stack (GSList *stack)
|
||||
{
|
||||
CoglFramebufferStackEntry *entry = l->data;
|
||||
|
||||
if (entry->draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN)
|
||||
_cogl_offscreen_free (COGL_OFFSCREEN (entry->draw_buffer));
|
||||
else
|
||||
_cogl_onscreen_free (COGL_ONSCREEN (entry->draw_buffer));
|
||||
if (entry->draw_buffer)
|
||||
{
|
||||
if (entry->draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN)
|
||||
_cogl_offscreen_free (COGL_OFFSCREEN (entry->draw_buffer));
|
||||
else
|
||||
_cogl_onscreen_free (COGL_ONSCREEN (entry->draw_buffer));
|
||||
}
|
||||
|
||||
if (entry->read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN)
|
||||
_cogl_offscreen_free (COGL_OFFSCREEN (entry->read_buffer));
|
||||
else
|
||||
_cogl_onscreen_free (COGL_ONSCREEN (entry->read_buffer));
|
||||
if (entry->read_buffer)
|
||||
{
|
||||
if (entry->read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN)
|
||||
_cogl_offscreen_free (COGL_OFFSCREEN (entry->read_buffer));
|
||||
else
|
||||
_cogl_onscreen_free (COGL_ONSCREEN (entry->read_buffer));
|
||||
}
|
||||
|
||||
g_slice_free (CoglFramebufferStackEntry, entry);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user