diff pidgin/win32/wspell.c @ 30900:3d045343e04d

Use some fully qualified dll locations. There wasn't anything wrong with this as far as I can tell, but since we know specifically where what we're looking for is, this is probably better. Also, plug a small leak and try to find our enchant dll instead of any other one that is in the PATH.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 31 Aug 2010 01:49:53 +0000
parents 140990e07e01
children 7f79ac13965c
line wrap: on
line diff
--- a/pidgin/win32/wspell.c	Tue Aug 31 01:23:28 2010 +0000
+++ b/pidgin/win32/wspell.c	Tue Aug 31 01:49:53 2010 +0000
@@ -73,25 +73,29 @@
 static void load_gtkspell() {
 	UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
 	gchar *tmp, *tmp2;
+
 	const char *path = g_getenv("PATH");
 	tmp = g_build_filename(wpurple_install_dir(), "spellcheck", NULL);
-	tmp2 = g_strdup_printf("%s%s%s", (path ? path : ""),
+	tmp2 = g_strdup_printf("%s%s%s", tmp,
 		(path ? G_SEARCHPATH_SEPARATOR_S : ""),
-		tmp);
+		(path ? path : ""));
 	g_free(tmp);
 	g_setenv("PATH", tmp2, TRUE);
+	g_free(tmp2);
 
+	tmp = g_build_filename(wpurple_install_dir(), "spellcheck", GTKSPELL_DLL, NULL);
 	/* Suppress error popups */
-	wpidginspell_new_attach_proxy = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_new_attach" );
+	wpidginspell_new_attach_proxy = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_new_attach" );
 	if (wpidginspell_new_attach_proxy) {
-		wpidginspell_get_from_text_view = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_get_from_text_view");
-		wpidginspell_detach = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_detach");
-		wpidginspell_set_language = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_set_language");
-		wpidginspell_recheck_all = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_recheck_all");
+		wpidginspell_get_from_text_view = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_get_from_text_view");
+		wpidginspell_detach = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_detach");
+		wpidginspell_set_language = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_set_language");
+		wpidginspell_recheck_all = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_recheck_all");
 	} else {
-		purple_debug_warning("wspell", "Couldn't load gtkspell (%s) \n", GTKSPELL_DLL);
+		purple_debug_warning("wspell", "Couldn't load gtkspell (%s) \n", tmp);
 		/*wpidginspell_new_attach = wgtkspell_new_attach;*/
 	}
+	g_free(tmp);
 	SetErrorMode(old_error_mode);
 }