static GMutex *mc_mutex = NULL;
#define HASHKEY_FORMAT_STRING "%d-%d-%d-%d-%d-%d-%d-%.3f-%.3f"
-#define HASHKEY_FORMAT_STRING_NOSHRINK "%d-%d-%d-%d-%d-%d-"
+#define HASHKEY_FORMAT_STRING_NOSHRINK_NOR_ALPHA "%d-%d-%d-%d-%d-%d-"
static VikLayerParamScale params_scales[] = {
/* min, max, step, digits (decimal places) */
static void cache_add(gchar *key, GdkPixbuf *pixbuf)
{
- if ( g_hash_table_insert ( cache, key, pixbuf ) ) {
+#if !GLIB_CHECK_VERSION(2,26,0)
+ // Only later versions of GLib actually return a value for this function
+ // Annoyingly the documentation doesn't say anything about this interface change :(
+ if ( g_hash_table_insert ( cache, key, pixbuf ) )
+#else
+ g_hash_table_insert ( cache, key, pixbuf );
+#endif
+ {
cache_size += gdk_pixbuf_get_rowstride(pixbuf) * gdk_pixbuf_get_height(pixbuf);
cache_size += 100;
}
if ( queue_tail == NULL )
return;
- g_snprintf ( key, sizeof(key), HASHKEY_FORMAT_STRING_NOSHRINK, x, y, z, type, zoom, 0 );
+ g_snprintf ( key, sizeof(key), HASHKEY_FORMAT_STRING_NOSHRINK_NOR_ALPHA, x, y, z, type, zoom, 0 );
len = strlen(key);
g_mutex_lock(mc_mutex);
/* TODO: check logic here */
do {
tmp = loop->next;
+ if ( tmp ) {
if ( strncmp(tmp->key, key, len) == 0 )
{
cache_remove(tmp->key);
}
else
loop = tmp;
-
+ } else
+ loop = NULL;
} while ( loop && (loop != queue_tail || tmp == NULL) );
/* loop thru list, looking for the one, compare first whatever chars */