After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 102884 - c++-application freezes or segfaults when changing gconf entries
c++-application freezes or segfaults when changing gconf entries
Status: RESOLVED NOTABUG
Product: gconfmm
Classification: Other
Component: general
git master
Other Linux
: Normal blocker
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2003-01-08 23:42 UTC by triendl.kj
Modified: 2011-01-16 23:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description triendl.kj 2003-01-08 23:42:13 UTC
hi,

i have reported this problem already to the gnomemm mailinglist 
(gnomemm-list@gnome.org). you can find the thread with the title 
"gconf(mm) buggy?".
as requested i file this bug report.

after problems with a bigger c++-application featuring gconf i wrote a 
test application in c++ and also in c to test whether gconfmm might be 
the problem.

the c-app runs smoothly without errors.
the c++-app either freezes or even segfaults (below is the core dump 
which is always the same when testing it more often).

here is what the app tests/what i did:
the app listens with a GConfClient to the "/apps/file-roller/ui" 
directory and runs a signal handler on a value_change of one of the 
keys in this gconf-directory (note that the handler does not change 
anything in the gui). if i change the ``history_len" key in the 
gconf-editor (the gnome system-tool) the first time, the signal 
value_changed is emitted normally.
but afterwards, if i click around (on the key itself and its value) the 
signal is emitted again and again in the c++-app, 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 or core dumps after 
some time.


----------
the debian-packages involved may be of interest:

Package: libgconfmm2.0-dev
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 424
Maintainer: Bradley Bell <btb@debian.org>
Source: gconfmm2.0
Version: 2.0.0-1
Depends: libgconfmm2.0-1 (= 2.0.0-1), libgtkmm2.0-dev (>= 2.0.1), 
libgconf2-dev (>= 1.1.8)
Conflicts: libgconfmm1.3-dev
Description: C++ wrappers for GConf2 (development files)

Package: libgconfmm2.0-1
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 144
Maintainer: Bradley Bell <btb@debian.org>
Source: gconfmm2.0
Version: 2.0.0-1
Depends: libc6 (>= 2.3.1-1), libgconf2-4 (>= 1.2.1-2.1), libglib2.0-0 
(>= 2.0.7), libgtkmm2.0-1, liblinc1 (>= 1:0.5.5), liborbit2 (>= 
1:2.4.4), libsigc++-1.2-5
Description: C++ wrappers for GConf2 (shared library)
Package: libgconfmm2.0-1
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 144
Maintainer: Bradley Bell <btb@debian.org>
Source: gconfmm2.0
Version: 2.0.0-1
Depends: libc6 (>= 2.3.1-1), libgconf2-4 (>= 1.2.1-2.1), libglib2.0-0 
(>= 2.0.7), libgtkmm2.0-1, liblinc1 (>= 1:0.5.5), liborbit2 (>= 
1:2.4.4), libsigc++-1.2-5
Description: C++ wrappers for GConf2 (shared library)


----------
here is the c++-test program:



#include <gtkmm.h>
#include <gconfmm.h>
#include <iostream>
#include <list>

using namespace std;
using Glib::ustring;


Glib::RefPtr <Gnome::Conf::Client> gb_pClient;

class MyWindow: public Gtk::Window
{
public:
	MyWindow()
		: Gtk::Window()
	{
		Gtk::VBox* pVBoxWhole = manage(new Gtk::VBox(false));
		Gtk::Button* pButton = manage(new Gtk::Button("test"));
		pVBoxWhole->pack_start(*pButton);
		add(*pVBoxWhole);
		
		ustring strDir = "/apps/file-roller/ui";
		gb_pClient->add_dir(strDir, 
Gnome::Conf::CLIENT_PRELOAD_ONELEVEL);
		list <Gnome::Conf::Entry> contEntries = 
gb_pClient->all_entries(strDir);

		cerr << "contEntries.size()=" << contEntries.size() << 
endl;
		list <Gnome::Conf::Entry>::const_iterator it = 
contEntries.begin();
		for (; it != contEntries.end(); it++)
		{
			const Gnome::Conf::Value& value = 
gb_pClient->get(it->get_key());
			cerr << "GConf: " << it->get_key() << "=" << 
value.get_type();
			if (value.get_type() == 2)
				cerr << ", value=" << value.get_int();
			else if (value.get_type() == 4)
				cerr << ", value=" << value.get_bool();
			else if (value.get_type() == 1)
				cerr << ", value=" << 
value.get_string();
			cerr << endl;
		}
	
		
gb_pClient->signal_value_changed().connect(SigC::slot(*this, 
&MyWindow::on_value_changed));
		show_all_children();
	}
	
	void on_value_changed(const ustring& strKey, const 
Gnome::Conf::Value& value)
	{
		cerr << "MyWindow::on_value_changed()" << endl;
		cerr << "strKey=" << strKey << endl;
	}
};


int main(int argc, char** argv)
{
	Gnome::Conf::init();
	gb_pClient = Gnome::Conf::Client::get_default_client();
	Gtk::Main main(argc, argv);
	MyWindow mw;
	main.run(mw);
	return 0;
}


----------
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;
}


----------
here is a part of the core dump from the c++-application (note, that it 
does not segfault every time):

Program terminated with signal 11, Segmentation fault.
  • #0 mallopt
    from /lib/libc.so.6
  • #1 malloc
    from /lib/libc.so.6
  • #2 g_malloc
    from /usr/lib/libglib-2.0.so.0
  • #3 IOP_ObjectKey_copy
    from /usr/lib/libORBit-2.so.0
  • #4 IOP_ObjectKey_copy
    from /usr/lib/libORBit-2.so.0
  • #5 ORBit_demarshal_IOR
    from /usr/lib/libORBit-2.so.0
  • #6 ORBit_demarshal_object
  • #7 ORBit_demarshal_value
    from /usr/lib/libORBit-2.so.0
  • #8 ORBit_small_invoke_adaptor
  • #9 ORBit_recv_buffer_return_sys_exception
  • #10 ORBit_recv_buffer_return_sys_exception
  • #11 ORBit_handle_request
    from /usr/lib/libORBit-2.so.0
  • #12 giop_connection_handle_input
  • #13 linc_connection_set_max_buffer
  • #14 linc_server_get_type
    from /usr/lib/liblinc.so.1
  • #15 g_get_current_time
    from /usr/lib/libglib-2.0.so.0
  • #16 g_main_context_dispatch
  • #17 g_main_context_dispatch
  • #18 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #19 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #20 Gtk::Main::run_impl
    from /usr/lib/libgtkmm-2.0.so.1
  • #21 Gtk::Main::run
    from /usr/lib/libgtkmm-2.0.so.1
  • #22 main
  • #23 __libc_start_main
    from /lib/libc.so.6

Comment 1 Murray Cumming 2003-01-09 06:43:52 UTC
Please just attach code as files in future.
Comment 2 Murray Cumming 2003-01-09 06:51:01 UTC
depends: libgconfmm2.0-1 (= 2.0.0-1), libgtkmm2.0-dev (>= 2.0.1), 
libgconf2-dev (>= 1.1.8)
Conflicts: libgconfmm1.3-dev

You seem to have a different gconfmm-dev version than your main
gconfmm deb. So the headers will be wrong. Please try again with a
sensible headers, even if you have to build from source. 
Comment 3 triendl.kj 2003-01-09 08:27:50 UTC
i don't think that the dev-version is different from the main package 
because both have the version 2.0.0-1;




anyway i'll verify it with self-compiled libraries.


Comment 4 Murray Cumming 2003-01-13 23:59:21 UTC
And what did you discover?
Comment 5 triendl.kj 2003-01-14 19:28:32 UTC
well, i found out that the test app linked with selfcompiled libs 
does neither freeze nor core dump.
i compiled
glib, atk, pango and gtk+2.0, orbit and orbitcpp and the mm-stuff 
except gconf (but i compiled gconfmm) with the 3.2-compiler.
the only point which still remains is that the value_changed 
signal is emitted even no value is changed (as described above).

however, not compiling gconf may be a problem..
i don't know how safe it is to install a self-compiled version of 
gconf. i need a working system..
additionally, debian is on the transition to gcc-3.2; therefore i 
will report again in a few weeks.
Comment 6 Murray Cumming 2003-01-20 22:58:39 UTC
It would have been helpful if you had just tried to rebuild the C++
libraries. I'll assume that you were just using bad binary packages,
because your system actually told you that you had a conflict and you
overrode it.