]> Pileus Git - grits/blobdiff - src/plugins/bmng.c
Handle broken images gracefully
[grits] / 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());
 }