From 7bc29f778280c8b4138206313774f5c589a8da4e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 27 Apr 2015 18:32:49 +0100 Subject: Attempt to fix spurious plotter crashes --- amiga/bitmap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/amiga/bitmap.c b/amiga/bitmap.c index 2aca7a3ba..c2fd2e786 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -522,6 +522,7 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content) int plot_height; struct MinList shared_pens; struct gui_globals bm_globals; + struct gui_globals *temp_gg = glob; struct redraw_context ctx = { .interactive = false, @@ -562,12 +563,18 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content) #endif /**\todo In theory we should be able to move the bitmap to our native area - to try to avoid re-conversion */ + to try to avoid re-conversion (at the expense of memory) */ ami_free_layers(&bm_globals); ami_plot_release_pens(&shared_pens); amiga_bitmap_set_opaque(bitmap, true); + /* Restore previous render area. This is set when plotting starts, + * but if bitmap_render is called *during* a browser render then + * having an invalid pointer here causes NetSurf to crash. + */ + glob = temp_gg; + return NSERROR_OK; } -- cgit v1.2.3