Re: [gnomemm] gconf(mm) buggy?



> > > >  - in my app it happens on every change, in the test app after some time.
> > > > 
> > > > am i doing something wrong? any hint is welcome, of course.
> > > > 
> > > 
> > > Is this a gconf problem or a gconfmm problem?
> > 
> > according to the core dump it looks like not, but note, that it doesn't always segfault.
> 
> If you rewrite your example in C then we will know. It's tedious I know.
> 
> -- 
> Murray Cumming


hi murray,

it was bloody work to recode this simple test in c - it's unbelievable how one gets used to c++.. and i appreciate your work on gtkmm much more :)
nevertheless, below is the c-code. i tested it and it NEITHER freezes the gui NOR segfaults.
what i found out additionally: if i run the c++-app listening with a Gnome::Conf::Client to the "/apps/file-roller/ui" directory and change the ``history_len" key in the gconf-editor the first time, the signal value_changed is emitted.
but afterwards, if i click around (on the key itself and its value) the signal is emitted again and again which is not the case in the c-app - even the value is NOT changed. by clicking around i mean: i do a double click (or how often it should be) to activate editing of the value (but i don't edit it) and then click the key - the signal is emitted at this moment.

this process ends up reproducably in gui-freezing and core dumps.



here is the test app in c:


#include <gtk/gtk.h>
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
#include <stdlib.h>
#include <stdio.h>


GConfClient* gb_pClient;

typedef struct MyWindow
{
	GtkWindow* m_parent;
	guint IDClient;
} MyWindow;

void on_value_changed(GConfClient*, guint, GConfEntry*, gpointer);

struct MyWindow* MyWindow_new()
{
	MyWindow* mw = NULL;
	GtkVBox* pVBoxWhole = NULL;
	GtkButton* pButton = NULL;
	GSList* contEntries = NULL;
	gchar strDir[] = "/apps/file-roller/ui";
	GConfEntry* pEntry = NULL;
	GConfValue* pValue = NULL;
	int i = 0;
	GSList* it = NULL;

	mw = (MyWindow*) malloc(sizeof(MyWindow));
	mw->m_parent = (GtkWindow*) gtk_window_new(GTK_WINDOW_TOPLEVEL);
	pVBoxWhole = (GtkVBox*) gtk_vbox_new(0, 0);
	pButton = (GtkButton*) gtk_button_new_with_label("test");
	
	gtk_container_add(GTK_CONTAINER(pVBoxWhole), GTK_WIDGET(pButton));
	gtk_container_add(GTK_CONTAINER(mw->m_parent), GTK_WIDGET(pVBoxWhole));
	gtk_widget_show(GTK_WIDGET(pButton));
	gtk_widget_show(GTK_WIDGET(pVBoxWhole));
	
	gconf_client_add_dir(gb_pClient, strDir, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
	contEntries = gconf_client_all_entries(gb_pClient, strDir, NULL);
	printf("contEntries.size()=%d\n", g_slist_length(contEntries));
	it = contEntries;
	for (i = 0; i < g_slist_length(contEntries); i++, it = g_slist_next(contEntries))
	{
		pEntry = (GConfEntry*) it->data;
		pValue = gconf_client_get(gb_pClient, gconf_entry_get_key(pEntry), NULL);
		printf("%s", gconf_entry_get_key(pEntry));
		if (pValue->type == GCONF_VALUE_INT)
			printf(", value=%d", gconf_value_get_int(pValue));
		if (pValue->type == GCONF_VALUE_BOOL)
			printf(", value=%d", gconf_value_get_bool(pValue));
		if (pValue->type == GCONF_VALUE_STRING)
			printf(", value=%s", gconf_value_get_string(pValue));
		printf("\n");
	}
	mw->IDClient = gconf_client_notify_add(gb_pClient, strDir, &on_value_changed, NULL, NULL, NULL);
	
	return mw;
}


void on_value_changed(GConfClient* client, guint cnxn_id, GConfEntry* entry, gpointer user_data)
{
	g_print("on_value_changed()\n%s\n", entry->key);
}



int main(int argc, char** argv)
{
	MyWindow* mw;

	gtk_init(&argc, &argv);
	gconf_init(argc, argv, NULL);
	gb_pClient = gconf_client_get_default();
	mw = MyWindow_new();
	gtk_widget_show(GTK_WIDGET(mw->m_parent));
	gtk_main();

	free(mw);
	return 0;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]