From: Andy Spencer Date: Wed, 11 Nov 2009 06:59:24 +0000 (+0000) Subject: Fix various win32 runtime issues X-Git-Tag: v0.4~156 X-Git-Url: http://pileus.org/git/?p=grits;a=commitdiff_plain;h=6ed798102c4b8c630188f1683e040e5d25128370 Fix various win32 runtime issues * Add -no-undefined so mingw-ld will generate dlls * Make gis_test static so we don't have double copies if the plugins when they're loaded. * Add gdk_threads_enter to opengl_start (to match opengl_end) * Various debugging messages --- diff --git a/src/.gitignore b/src/.gitignore index 40465d3..8601add 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,3 +1,4 @@ +*.exe *.la *.lo *.o diff --git a/src/Makefile.am b/src/Makefile.am index 70ebf3c..d82df9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = . plugins -AM_CFLAGS = -Wall --std=gnu99 +AM_CFLAGS = -Wall --std=gnu99 AM_CPPFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS) $(SOUP_CFLAGS) AM_LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(SOUP_LIBS) @@ -35,6 +35,7 @@ libgis_la_SOURCES = \ libgis_la_CPPFLAGS = $(AM_CPPFLAGS) \ -DPKGDATADIR="\"$(datadir)/gis\"" -DPLUGINSDIR="\"$(libdir)/gis\"" libgis_la_LIBADD = $(AM_LDADD) +libgis_la_LDFLAGS = -no-undefined pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgis.pc @@ -43,7 +44,6 @@ pkgconfig_DATA = libgis.pc bin_PROGRAMS = gis_test wms_test gis_test_SOURCES = gis_test.c gis.h -gis_test_LDFLAGS = -static gis_test_LDADD = $(AM_LDADD) libgis.la wms_test_SOURCES = wms_test.c gis-world.c gis-world.h gis-wms.c gis-wms.h gis-tile.c gis-tile.h diff --git a/src/gis-opengl.c b/src/gis-opengl.c index c1d48ac..866eac8 100644 --- a/src/gis-opengl.c +++ b/src/gis-opengl.c @@ -399,6 +399,8 @@ void gis_opengl_begin(GisOpenGL *self) { g_assert(GIS_IS_OPENGL(self)); + gdk_threads_enter(); + GdkGLContext *glcontext = gtk_widget_get_gl_context(GTK_WIDGET(self)); GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(GTK_WIDGET(self)); diff --git a/src/gis-plugin.c b/src/gis-plugin.c index eb162b7..57ad922 100644 --- a/src/gis-plugin.c +++ b/src/gis-plugin.c @@ -123,16 +123,18 @@ GisPlugin *gis_plugins_load(GisPlugins *self, const char *name, { g_debug("GisPlugins: load %s", name); gchar *path = g_strdup_printf("%s/%s.%s", self->dir, name, G_MODULE_SUFFIX); + g_debug("GisPlugins: load - trying %s", path); if (!g_file_test(path, G_FILE_TEST_EXISTS)) { g_free(path); path = g_strdup_printf("%s/%s.%s", PLUGINSDIR, name, G_MODULE_SUFFIX); } + g_debug("GisPlugins: load - trying %s", path); if (!g_file_test(path, G_FILE_TEST_EXISTS)) { g_warning("Module %s not found", name); g_free(path); return NULL; } - GModule *module = g_module_open(path, 0); + GModule *module = g_module_open(path, G_MODULE_BIND_LAZY); g_free(path); if (module == NULL) { g_warning("Unable to load module %s: %s", name, g_module_error()); diff --git a/src/gis-wms.c b/src/gis-wms.c index bd4704d..d2e0766 100644 --- a/src/gis-wms.c +++ b/src/gis-wms.c @@ -75,8 +75,10 @@ static gchar *_make_uri(GisWms *wms, GisTile *tile) void gis_wms_soup_chunk_cb(SoupMessage *message, SoupBuffer *chunk, gpointer _file) { FILE *file = _file; - if (!SOUP_STATUS_IS_SUCCESSFUL(message->status_code)) + if (!SOUP_STATUS_IS_SUCCESSFUL(message->status_code)) { + g_warning("GisWms: soup_chunk_cb - soup failed with %d", message->status_code); return; + } goffset total = soup_message_headers_get_content_length(message->response_headers); if (fwrite(chunk->data, chunk->length, 1, file) != 1) g_warning("GisWms: soup_chunk_cb - eror writing data"); @@ -104,10 +106,13 @@ char *gis_wms_make_local(GisWms *self, GisTile *tile) /* Download file */ gchar *uri = _make_uri(self, tile); + g_debug("GisWms: make_local - fetching %s", uri); SoupMessage *message = soup_message_new("GET", uri); g_signal_connect(message, "got-chunk", G_CALLBACK(gis_wms_soup_chunk_cb), file); soup_message_headers_set_range(message->request_headers, ftell(file), -1); int status = soup_session_send_message(self->soup, message); + if (!SOUP_STATUS_IS_SUCCESSFUL(message->status_code)) + g_warning("GisWms: make_local - soup failed with %d", message->status_code); g_free(uri); /* Clean up */ diff --git a/src/gis_test.c b/src/gis_test.c index efd9218..32bed7b 100644 --- a/src/gis_test.c +++ b/src/gis_test.c @@ -60,7 +60,7 @@ int main(int argc, char **argv) gdk_threads_leave(); gis_plugins_load(plugins, "bmng", world, view, opengl, prefs); - gis_plugins_load(plugins, "srtm", world, view, opengl, prefs); + //gis_plugins_load(plugins, "srtm", world, view, opengl, prefs); gis_view_set_site(view, "KLSX"); diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 2c5e2f9..e97bf6f 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -2,7 +2,7 @@ MAINTAINERCLEANFILES = Makefile.in AM_CFLAGS = -Wall --std=gnu99 -I../ AM_CPPFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS) $(SOUP_CFLAGS) -AM_LDFLAGS = -module -avoid-version +AM_LDFLAGS = -module -avoid-version -no-undefined LIBS = $(top_srcdir)/src/libgis.la pluginsdir = "$(libdir)/gis" diff --git a/src/plugins/bmng.c b/src/plugins/bmng.c index 8404f5e..5f29aa0 100644 --- a/src/plugins/bmng.c +++ b/src/plugins/bmng.c @@ -77,6 +77,8 @@ 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) + g_warning("GisPluginBmng: _load_tile - Error loading pixbuf %s", 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());