Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread Andrew Wood
Still getting strange results with this. Ive posted a skeleton app at www.simple.org/TCSAdminGTK.tar which is a single source file which can be comiled with g++ ./main.cpp `pkg-config --cflags --libs libgnome-2.0 libgnomeui-2.0 libglade-2.0` When you click one of the options on the left

gtk_builder_add_from_file error handling

2010-01-13 Thread Gabriele Greco
I just found that with a builder file with a syntax error my app crashed with: *** glibc detected *** ./packager: double free or corruption (out): 0x09aa33d0 *** I think I'm using gtkbuilder error handling in the right way and documentation does not suggest my how to use it: GError *err = NULL;

gtk_builder_add_from_file error handling

2010-01-13 Thread Gabriele Greco
Sorry last message was sent by accident pushing an hotkey while editing... This should be the complete version of my question: I just found that with a builder file with a syntax error my app crashed with: *** glibc detected *** ./packager: double free or corruption (out): 0x09aa33d0 *** I

Re: gtk_builder_add_from_file error handling

2010-01-13 Thread Florian Müllner
On Wed, 2010-01-13 at 11:52 +0100, Gabriele Greco wrote: GError *err = NULL; if (!gtk_builder_add_from_file(builder_, myfile.xml, err)) { if (err) { cerr builder load fail: err-message '\n'; g_free(err); // commenting this solves the crash but other gtk apis

Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread David Nečas
On Wed, Jan 13, 2010 at 10:33:07AM +, Andrew Wood wrote: Still getting strange results with this. Ive posted a skeleton app at www.simple.org/TCSAdminGTK.tar which is a single source file which can be comiled with g++ ./main.cpp `pkg-config --cflags --libs libgnome-2.0

Re: gtk_builder_add_from_file error handling

2010-01-13 Thread Gabriele Greco
GError *err = NULL; if (!gtk_builder_add_from_file(builder_, myfile.xml, err)) { if (err) { g_free(err); // commenting this solves the crash but other gtk apis I don't know gtkmm, but at least in C GErrors are freed with g_error_free(err). You are obviously right. I always

Re: gtk_builder_add_from_file error handling

2010-01-13 Thread David Nečas
On Wed, Jan 13, 2010 at 04:48:29PM +0100, Gabriele Greco wrote: ... I've found there are a lot of other sources in the net where a GError is freed with g_free, I think improving the documentation of the functions that use a GError as input parameter may help programmers do not write wrong code

Re: gtk_builder_add_from_file error handling

2010-01-13 Thread Gabriele Greco
The proper handling of GErrors is described in great detail in the GError documentation. I don't think it is reasonable to explain this in the documentation of every function that uses GError to report errors as there are almost 80 of them just in Gtk+ (and over 400 in GLib, and many more

Re: gtk_builder_add_from_file error handling

2010-01-13 Thread Emmanuele Bassi
On Wed, 2010-01-13 at 17:18 +0100, Gabriele Greco wrote: The proper handling of GErrors is described in great detail in the GError documentation. I don't think it is reasonable to explain this in the documentation of every function that uses GError to report errors as there are

Re: gtk_builder_add_from_file error handling

2010-01-13 Thread David Nečas
On Wed, Jan 13, 2010 at 05:18:04PM +0100, Gabriele Greco wrote: I think, and I'm used to see in almost every framework documentations, that every time a function allocates something that the API user must free himself the documentation should explicitly say so. Documentation should be

Draggable Targets

2010-01-13 Thread Tim Corio
I have another newbie question. I'm grateful that this list has been very indulgent of my recent questions. I want to let the user place a target (either a cross-hair or a circle) on an image and then be able to drag it to a new location. This seems like common functionality that GTK+ might

Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread Andrew Wood
Great thanks On 13 Jan 2010, at 11:05, David Nečas wrote: On Wed, Jan 13, 2010 at 10:33:07AM +, Andrew Wood wrote: Still getting strange results with this. Ive posted a skeleton app at www.simple.org/TCSAdminGTK.tar which is a single source file which can be comiled with g++

Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread Andrew Wood
Just tried it with a simple vbox and label created manually and am getting exactly the same problem so its not specific to libglade David Nečas wrote: On Wed, Jan 13, 2010 at 10:33:07AM +, Andrew Wood wrote: Still getting strange results with this. Ive posted a skeleton app at

Re: Problem swapping GtkScrolledWindow contents on the fly

2010-01-13 Thread David Nečas
On Wed, Jan 13, 2010 at 08:26:57PM +, Andrew Wood wrote: Just tried it with a simple vbox and label created manually and am getting exactly the same problem so its not specific to libglade If I do this: --- main.cpp.orig 2010-01-13 22:36:25.0 +0100 +++ main.cpp