]> Pileus Git - grits/commitdiff
Handle broken images gracefully
authorAndy Spencer <andy753421@gmail.com>
Mon, 25 Jan 2010 20:52:35 +0000 (20:52 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 25 Jan 2010 21:58:05 +0000 (21:58 +0000)
Don't add broken data to tiles and delete broken pixmaps from disk.

Don't attempt to re-fetch it though, since that could infinite loop.

src/plugins/bmng.c

index c7b65fe72374beef6450d2269925bccc099dd89b..648b9ba620ea3d78a2efd7ceb44effc7a3e56cc3 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <time.h>
+#include <glib/gstdio.h>
 #include <GL/gl.h>
 
 #include <gis.h>
@@ -77,10 +78,13 @@ static void _load_tile(GisTile *tile, gpointer _self)
        data->self   = self;
        data->tile   = tile;
        data->pixbuf = gdk_pixbuf_new_from_file(path, NULL);
-       if (!data->pixbuf)
+       if (data->pixbuf) {
+               g_idle_add_full(G_PRIORITY_LOW, _load_tile_cb, data, NULL);
+       } else {
                g_warning("GisPluginBmng: _load_tile - Error loading pixbuf %s", path);
+               g_remove(path);
+       }
        g_free(path);
-       g_idle_add_full(G_PRIORITY_LOW, _load_tile_cb, data, NULL);
        g_debug("GisPluginBmng: _load_tile end %p", g_thread_self());
 }