diff options
| author | bulia byak <buliabyak@gmail.com> | 2006-10-14 17:46:24 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2006-10-14 17:46:24 +0000 |
| commit | 792957dc4cacc0dbeee121bed5b1662e5acf04cd (patch) | |
| tree | 529804c3d1f352ae36a2a2190edca9bf0e791fd1 /src/display/nr-arena-shape.cpp | |
| parent | gracefully fail if unable to allocate memory or if more than 100Mb buffer req... (diff) | |
| download | inkscape-792957dc4cacc0dbeee121bed5b1662e5acf04cd.tar.gz inkscape-792957dc4cacc0dbeee121bed5b1662e5acf04cd.zip | |
deal with the possible failure to create pixblock due to insufficient memory
(bzr r1800)
Diffstat (limited to 'src/display/nr-arena-shape.cpp')
| -rw-r--r-- | src/display/nr-arena-shape.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 2f278b3de..32efc527a 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -707,6 +707,13 @@ nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned guint32 rgba; nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE); + + // if memory allocation failed, abort render + if (m.data.px == NULL) { + nr_pixblock_release (&m); + return (item->state); + } + m.visible_area = pb->visible_area; nr_pixblock_render_shape_mask_or(m,shape->fill_shp); m.empty = FALSE; @@ -738,6 +745,13 @@ nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned guint32 rgba; nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE); + + // if memory allocation failed, abort render + if (m.data.px == NULL) { + nr_pixblock_release (&m); + return (item->state); + } + m.visible_area = pb->visible_area; nr_pixblock_render_shape_mask_or(m, shape->stroke_shp); m.empty = FALSE; @@ -797,6 +811,13 @@ nr_arena_shape_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb) /* fixme: We can OR in one step (Lauris) */ nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE); + + // if memory allocation failed, abort + if (m.data.px == NULL) { + nr_pixblock_release (&m); + return (item->state); + } + m.visible_area = pb->visible_area; nr_pixblock_render_shape_mask_or(m,shape->fill_shp); |
