]> Pileus Git - grits/blobdiff - src/plugins/srtm.c
Update copyright and email address
[grits] / src / plugins / srtm.c
index 4e1126aabf7cdd2c5cbbcdc552733d6087f1b47c..f127af7a4b2a0cbc8a475cb88ce193c86aae8a0b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
+ * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -65,6 +65,10 @@ static gdouble _height_func(gdouble lat, gdouble lon, gpointer _self)
        guint x_flr = (int)x;
        guint y_flr = (int)y;
 
+       //if (lon == 180 || lon == -180)
+       //      g_message("lon=%f w=%d min=%f max=%f dist=%f x=%f rem=%f flr=%d",
+       //                 lon,   w,  xmin,  xmax,  xdist,   x, x_rem, x_flr);
+
        /* TODO: Fix interpolation at edges:
         *   - Pad these at the edges instead of wrapping/truncating
         *   - Figure out which pixels to index (is 0,0 edge, center, etc) */
@@ -208,7 +212,7 @@ static gboolean _free_tile_cb(gpointer _data)
 static void _free_tile(GisTile *tile, gpointer _self)
 {
        GisPluginSrtm *self = _self;
-       g_debug("GisPluginSrtm: _free_tile: %p=%d", tile->data, *(guint*)tile->data);
+       g_debug("GisPluginSrtm: _free_tile: %p", tile->data);
        g_idle_add_full(G_PRIORITY_LOW, _free_tile_cb, tile->data, NULL);
 }
 
@@ -254,7 +258,7 @@ GisPluginSrtm *gis_plugin_srtm_new(GisViewer *viewer)
 {
        g_debug("GisPluginSrtm: new");
        GisPluginSrtm *self = g_object_new(GIS_TYPE_PLUGIN_SRTM, NULL);
-       self->viewer = viewer;
+       self->viewer = g_object_ref(viewer);
 
        /* Load initial tiles */
        _load_tile(self->tiles, self);
@@ -301,9 +305,13 @@ static void gis_plugin_srtm_dispose(GObject *gobject)
        g_debug("GisPluginSrtm: dispose");
        GisPluginSrtm *self = GIS_PLUGIN_SRTM(gobject);
        /* Drop references */
-       g_signal_handler_disconnect(self->viewer, self->sigid);
        if (LOAD_BIL)
                gis_viewer_clear_height_func(self->viewer);
+       if (self->viewer) {
+               g_signal_handler_disconnect(self->viewer, self->sigid);
+               g_object_unref(self->viewer);
+               self->viewer = NULL;
+       }
        G_OBJECT_CLASS(gis_plugin_srtm_parent_class)->dispose(gobject);
 }
 static void gis_plugin_srtm_finalize(GObject *gobject)