From ddcc1cf6aa114eb212554ea28b64b6bbf7329f5a Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 18 Jan 2017 18:43:52 +0100 Subject: [PATCH] gems/png_image.h: fix context pointer handling This patch fixes a problem that unsurfaced by the commit "menu_view: API transition", which changed the class layout of the 'Png_image' so that the 'Read_struct' pointer is no longer equal to the 'Png_image' pointer. --- repos/gems/include/gems/png_image.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repos/gems/include/gems/png_image.h b/repos/gems/include/gems/png_image.h index 1dc6391716..fcc6416c55 100644 --- a/repos/gems/include/gems/png_image.h +++ b/repos/gems/include/gems/png_image.h @@ -59,9 +59,9 @@ class Png_image static void callback(png_structp png_ptr, png_bytep dst, png_size_t len) { - Png_image *png = (Png_image *)png_get_io_ptr(png_ptr); - Genode::memcpy(dst, png->_read_struct.data + png->_read_struct.pos, len); - png->_read_struct.pos += len; + Read_struct &read_struct = *(Read_struct *)png_get_io_ptr(png_ptr); + Genode::memcpy(dst, read_struct.data + read_struct.pos, len); + read_struct.pos += len; } png_structp png_ptr =