Commit d47f64ac authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Always check for NULL when using callbacks. (#330563, Benjamin Otte)

2006-02-10  Matthias Clasen  <mclasen@redhat.com>

        * io-jpeg.c:
        * io-png.c:
        * io-pnm.c:
        * io-tiff.c:
        * io-xbm.c:
        * io-xpm.c: Always check for NULL when using callbacks.
        (#330563, Benjamin Otte)
parent adce3190
2006-02-10 Matthias Clasen <mclasen@redhat.com>
* io-jpeg.c:
* io-png.c:
* io-pnm.c:
* io-tiff.c:
* io-xbm.c:
* io-xpm.c: Always check for NULL when using callbacks.
(#330563, Benjamin Otte)
2006-01-18 Matthias Clasen <mclasen@redhat.com>
* io-gif.c (gdk_pixbuf__gif_image_load_increment): Don't cast
......
......@@ -595,12 +595,13 @@ gdk_pixbuf__jpeg_image_load_lines (JpegProgContext *context,
context->dptr += nlines * context->pixbuf->rowstride;
/* send updated signal */
(* context->updated_func) (context->pixbuf,
0,
cinfo->output_scanline - 1,
cinfo->image_width,
nlines,
context->user_data);
if (context->updated_func)
(* context->updated_func) (context->pixbuf,
0,
cinfo->output_scanline - 1,
cinfo->image_width,
nlines,
context->user_data);
}
return TRUE;
......@@ -745,9 +746,10 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
context->dptr = context->pixbuf->pixels;
/* Notify the client that we are ready to go */
(* context->prepared_func) (context->pixbuf,
NULL,
context->user_data);
if (context->prepared_func)
(* context->prepared_func) (context->pixbuf,
NULL,
context->user_data);
} else if (!context->did_prescan) {
int rc;
......
......@@ -517,7 +517,7 @@ gdk_pixbuf__png_image_load_increment(gpointer context,
lc->error = NULL;
return FALSE;
} else {
if (lc->first_row_seen_in_chunk >= 0) {
if (lc->first_row_seen_in_chunk >= 0 && lc->update_func) {
/* We saw at least one row */
gint pass_diff = lc->last_pass_seen_in_chunk - lc->first_pass_seen_in_chunk;
......
......@@ -1015,9 +1015,10 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data,
context->rowstride = context->pixbuf->rowstride;
/* Notify the client that we are ready to go */
(* context->prepared_func) (context->pixbuf,
NULL,
context->user_data);
if (context->prepared_func)
(* context->prepared_func) (context->pixbuf,
NULL,
context->user_data);
}
/* if we got here we're reading image data */
......@@ -1028,7 +1029,7 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data,
break;
} else if (retval == PNM_FATAL_ERR) {
return FALSE;
} else if (retval == PNM_OK) {
} else if (retval == PNM_OK && context->updated_func) {
/* send updated signal */
(* context->updated_func) (context->pixbuf,
0,
......
......@@ -238,7 +238,7 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
return NULL;
}
if (context)
if (context && context->prepare_func)
(* context->prepare_func) (pixbuf, NULL, context->user_data);
#if TIFFLIB_VERSION >= 20031226
......@@ -324,7 +324,7 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
_TIFFfree (rast);
}
if (context)
if (context && context->update_func)
(* context->update_func) (pixbuf, 0, 0, width, height, context->user_data);
return pixbuf;
......
......@@ -309,7 +309,7 @@ gdk_pixbuf__xbm_image_load_real (FILE *f, XBMData *context, GError **error)
pixels = gdk_pixbuf_get_pixels (pixbuf);
row_stride = gdk_pixbuf_get_rowstride (pixbuf);
if (context)
if (context && context->prepare_func)
(* context->prepare_func) (pixbuf, NULL, context->user_data);
......@@ -338,7 +338,8 @@ gdk_pixbuf__xbm_image_load_real (FILE *f, XBMData *context, GError **error)
g_free (data);
if (context) {
(* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
if (context->update_func)
(* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
g_object_unref (pixbuf);
pixbuf = NULL;
}
......
......@@ -738,10 +738,12 @@ gdk_pixbuf__xpm_image_stop_load (gpointer data,
pixbuf = gdk_pixbuf__xpm_image_load (context->file, error);
if (pixbuf != NULL) {
(* context->prepare_func) (pixbuf,
NULL,
context->user_data);
(* context->update_func) (pixbuf, 0, 0, pixbuf->width, pixbuf->height, context->user_data);
if (context->prepare_func)
(* context->prepare_func) (pixbuf,
NULL,
context->user_data);
if (context->update_func)
(* context->update_func) (pixbuf, 0, 0, pixbuf->width, pixbuf->height, context->user_data);
g_object_unref (pixbuf);
retval = TRUE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment