diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2007-02-23 06:50:34 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2007-02-23 06:50:34 +0000 |
| commit | f3bb6b6276e265290b59c0641c8df755cf605981 (patch) | |
| tree | 8a3263f32ed5a75757ec8417e16202f01392961d /src/widgets/icon.cpp | |
| parent | Disabling transientize callback - it's currently causing some data loss (diff) | |
| download | inkscape-f3bb6b6276e265290b59c0641c8df755cf605981.tar.gz inkscape-f3bb6b6276e265290b59c0641c8df755cf605981.zip | |
Fixed crash when draw height was zero.
(bzr r2420)
Diffstat (limited to 'src/widgets/icon.cpp')
| -rw-r--r-- | src/widgets/icon.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index dd7770ac1..adf876949 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -529,12 +529,17 @@ static void sp_icon_paint(SPIcon *icon, GdkRectangle const *area) int const x1 = std::min(area->x + area->width, widget.allocation.x + padx + static_cast<int>(icon->psize) ); int const y1 = std::min(area->y + area->height, widget.allocation.y + pady + static_cast<int>(icon->psize) ); - gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image, - x0 - widget.allocation.x - padx, - y0 - widget.allocation.y - pady, - x0, y0, - x1 - x0, y1 - y0, - GDK_RGB_DITHER_NORMAL, x0, y0); + int width = x1 - x0; + int height = y1 - y0; + // Limit drawing to when we actually have something. Avoids some crashes. + if ( (width > 0) && (height > 0) ) { + gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image, + x0 - widget.allocation.x - padx, + y0 - widget.allocation.y - pady, + x0, y0, + width, height, + GDK_RGB_DITHER_NORMAL, x0, y0); + } } } |
