This patch updates the gconf native peer. Mark found some sychronization issues while accessing code in the native layer, this patch should fix it.
We reviewed the patch on the irc channel, so I was given the ok to
commit, but if you find here something wrong, please let me know so that
I can fix it again.
Mario
Changelog:
2006-07-16 Mario Torre <[EMAIL PROTECTED]>
* native/jni/gconf-peer/GConfNativePeer.c (init_gconf_client):
Fixed comment. This functions now requires to be called
with gdk lock held, the comment states that.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1id_1cache):
Introduces gdk locks around critical regions of code.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1keys):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1nodes):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1suggest_1sync):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1unset):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1get_1string):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1set_1string):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1remove_1dir):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1add_1dir):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1dir_1exists):
Likewise.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_finalize_1class):
* native/jni/gconf-peer/Makefile.am: The GConf peer now depends on GTK.
--
Lima Software, SO.PR.IND. s.r.l.
http://www.limasoftware.net/
pgp key: http://subkeys.pgp.net/
Please, support open standards:
http://opendocumentfellowship.org/petition/
http://www.nosoftwarepatents.com/
### Eclipse Workspace Patch 1.0
#P classpath
Index: native/jni/gconf-peer/GConfNativePeer.c
===================================================================
RCS file: /sources/classpath/classpath/native/jni/gconf-peer/GConfNativePeer.c,v
retrieving revision 1.5
diff -u -r1.5 GConfNativePeer.c
--- native/jni/gconf-peer/GConfNativePeer.c 12 Jul 2006 15:04:55 -0000 1.5
+++ native/jni/gconf-peer/GConfNativePeer.c 15 Jul 2006 22:56:11 -0000
@@ -41,6 +41,7 @@
#include <jni.h>
#include <glib.h>
+#include <gdk/gdk.h>
#include <gconf/gconf-client.h>
#include "jcl.h"
@@ -72,6 +73,7 @@
* Gets the reference of the default GConfClient and initialize the
* the type system.
* The client reference should be released with g_object_unref after use.
+ * This functions must be called with gdk lock held.
*/
static void init_gconf_client (void);
@@ -131,7 +133,9 @@
{
reference_count++;
+ gdk_threads_enter ();
init_gconf_client ();
+ gdk_threads_leave ();
/* if client is null, there is probably an out of memory */
if (client == NULL)
@@ -160,6 +164,8 @@
Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1keys
(JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node)
{
+ /* TODO: check all the calls to gdk_threads_enter/leave */
+
const char *dir = NULL;
GError *err = NULL;
GSList *entries = NULL;
@@ -174,7 +180,9 @@
return NULL;
}
+ gdk_threads_enter ();
entries = gconf_client_all_entries (client, dir, &err);
+ gdk_threads_leave ();
if (err != NULL)
{
throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
@@ -212,7 +220,7 @@
JCL_free_cstring (env, node, dir);
g_slist_foreach (entries, (GFunc) gconf_entry_free, NULL);
g_slist_free (entries);
-
+
return jlist;
}
@@ -239,7 +247,9 @@
return NULL;
}
+ gdk_threads_enter ();
entries = gconf_client_all_dirs (client, dir, &err);
+ gdk_threads_leave ();
if (err != NULL)
{
throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
@@ -291,7 +301,9 @@
{
GError *err = NULL;
+ gdk_threads_enter ();
gconf_client_suggest_sync (client, &err);
+ gdk_threads_leave ();
if (err != NULL)
{
throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
@@ -320,7 +332,9 @@
return JNI_FALSE;
}
+ gdk_threads_enter ();
result = gconf_client_unset (client, _key, &err);
+ gdk_threads_leave ();
if (err != NULL)
{
result = JNI_FALSE;
@@ -353,7 +367,9 @@
return NULL;
}
+ gdk_threads_enter ();
_value = gconf_client_get_string (client, _key, &err);
+ gdk_threads_leave ();
JCL_free_cstring (env, key, _key);
if (err != NULL)
{
@@ -400,7 +416,9 @@
return JNI_FALSE;
}
+ gdk_threads_enter ();
result = gconf_client_set_string (client, _key, _value, &err);
+ gdk_threads_leave ();
if (err != NULL)
{
g_error_free (err);
@@ -429,7 +447,9 @@
if (dir == NULL)
return;
+ gdk_threads_enter ();
gconf_client_remove_dir (client, dir, NULL);
+ gdk_threads_leave ();
JCL_free_cstring (env, node, dir);
}
@@ -450,7 +470,9 @@
return;
/* ignore errors */
+ gdk_threads_enter ();
gconf_client_add_dir (client, dir, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ gdk_threads_leave ();
JCL_free_cstring (env, node, dir);
}
@@ -473,7 +495,9 @@
return value;
/* on error return false */
+ gdk_threads_enter ();
value = gconf_client_dir_exists (client, dir, &err);
+ gdk_threads_leave ();
if (err != NULL)
value = JNI_FALSE;
@@ -494,7 +518,9 @@
if (reference_count == 0)
{
/* last reference, free all resources and return */
+ gdk_threads_enter ();
g_object_unref (G_OBJECT (client));
+ gdk_threads_leave ();
(*env)->DeleteGlobalRef (env, jlist_class);
Index: native/jni/gconf-peer/Makefile.am
===================================================================
RCS file: /sources/classpath/classpath/native/jni/gconf-peer/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- native/jni/gconf-peer/Makefile.am 18 Jun 2006 18:33:10 -0000 1.2
+++ native/jni/gconf-peer/Makefile.am 15 Jul 2006 22:56:11 -0000
@@ -5,10 +5,8 @@
libgconfpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
$(top_builddir)/native/jni/classpath/jcl.lo
-AM_LDFLAGS = @CLASSPATH_MODULE@ @GCONF_LIBS@
[EMAIL PROTECTED]@ @GCONF_LIBS@ @CAIRO_LIBS@ @FREETYPE2_LIBS@ \
-# @PANGOFT2_LIBS@ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXtst
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GCONF_LIBS@ @GTK_LIBS@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
-AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ @GCONF_CFLAGS@
+AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ @GCONF_CFLAGS@ @GTK_CFLAGS@
signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente
