]> Pileus Git - ~andy/gtk/commitdiff
Always check for NULL when using callbacks. (#330563, Benjamin Otte)
authorMatthias Clasen <mclasen@redhat.com>
Fri, 10 Feb 2006 19:02:38 +0000 (19:02 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 10 Feb 2006 19:02:38 +0000 (19:02 +0000)
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)

gdk-pixbuf/ChangeLog
gdk-pixbuf/io-jpeg.c
gdk-pixbuf/io-png.c
gdk-pixbuf/io-pnm.c
gdk-pixbuf/io-tiff.c
gdk-pixbuf/io-xbm.c
gdk-pixbuf/io-xpm.c

index 08f86164f953a8c8b55ef6193da07793e243eb1c..e75a29083d2a13156bf71b01628f254a9d9f0152 100644 (file)
@@ -1,3 +1,13 @@
+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
index 84376d51ba9761f26dc3f2730a1e75d63439a545..96b3453b041695daae5dbc1febafecefe34c9e24 100644 (file)
@@ -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;                 
index deab99ae126866f668bcfe04e2590cfdc528f966..f662c07da1633ef0559b9d1c33a42ce8477e3f06 100644 (file)
@@ -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;
                         
index 81e50a7f79d2fb539766f7480e4353b3b36e65e4..81225740ad46fb6c5d4df8ea1f073e8abae96aad 100644 (file)
@@ -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, 
index e874e4d9108aefd28a8a8a06cbf235d409523b2e..4e81367908e73ae58a8c616ff6fd98b9b0fb17e0 100644 (file)
@@ -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;
index 9d808703e6caf42fdcc3158fb7822012f7e3f240..90d8120a187ea801bda24aa2c532a0fb5bd74acf 100644 (file)
@@ -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;
        }
index 7f020cd96427e151435218937a2609641a40e64c..3357aab4b502969c95b943b67a716d521512e9d7 100644 (file)
@@ -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;