Text View Complaining about Double Free or Corruption
Was wondering if anybody has any idea(s) why the code below would seem to work fine on GTK/X11 (at least I don't see any error messages), but fail on GTK/DirectFB? When the application is exited by hitting the Quit button, I receive the following error message: *** glibc detected *** TextDemo: double free or corruption (out): 0x4035b1b0 *** I'm trying to figure out if this is a GTK related problem (i.e., I'm doing something wrong with GTK) or a problem with GTK/DirectFB. Thanks in advance for any suggestions / help. [code] #include common.h GtkWidget* main_window; static gboolean destroy_event(GtkWidget* widget, void* data) { gtk_main_quit(); return FALSE; } static void button_click_event(void) { gtk_widget_destroy(main_window); } int main(int argc, char* argv[]) { GtkWidget *text_view, *box, *button; // initialize multi-threading within GLib g_thread_init(NULL); // initialize multi-threading within GDK gdk_threads_init(); // acquire thread lock gdk_threads_enter(); gtk_init(argc, argv); // create main window main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (main_window == NULL) abort(); g_signal_connect(G_OBJECT(main_window), destroy, G_CALLBACK(destroy_event), NULL); gtk_widget_show(main_window); box = gtk_vbox_new(FALSE, 5); if (box == NULL) abort(); gtk_widget_show(box); gtk_container_add(GTK_CONTAINER(main_window), box); text_view = gtk_text_view_new(); if (text_view == NULL) abort(); gtk_widget_show(text_view); gtk_box_pack_start(GTK_BOX(box), text_view, TRUE, TRUE, 5); button = gtk_button_new_with_label(Quit); if (button == NULL) abort(); g_signal_connect(G_OBJECT(button), clicked, G_CALLBACK(button_click_event), NULL); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 5); // run the main loop gtk_main(); // release thread lock gdk_threads_leave(); return 0; } [/code] -- Mark ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to set background for a gtk window form using .gtkrc file
I have searched some articles, it's compositing manager, am I right? 在08-2-25,Bin Chen [EMAIL PROTECTED] 写道: On Mon, Feb 25, 2008 at 9:13 PM, 邓超 [EMAIL PROTECTED] wrote: Hi all, I want to use .gtkrc file to set the background for a window form to transparent, how to do it? I have read the tutorial at live.gnome.com, but it looks that it just can set color for a window form. Thanks! Gtk can't do window transparent, its X window's funciotionality. Bin -- Deng Chao ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Get signals and callbacks.
Hello. I'm implementing an application in gtkmm. I want to add support for dynamic signal connection from a glade file in C++ (which is not supported by the C++ bindings). I'd like to know if there is a way, once a glade file has been instantiated, to obtain information about the signals and handlers attached to every widget from the Gobject objects and how I should do it. I tried to do like this: guint nids = 0; guint * ids = g_signal_list_ids(g_type_from_name(GtkButton), nids); std::cout nids std::endl; std::cout g_signal_name(ids[23]) std::endl; but if I use GtkButton, nids == 0. However, when I use GtkWidget I get a 67 and signals can be get with the function g_signal_names(ids[i]); This code is to get available signals, but not the real connections between objects. Can help, please? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to set background for a gtk window form using .gtkrc file
On Tue, Feb 26, 2008 at 8:23 PM, 邓超 [EMAIL PROTECTED] wrote: I have searched some articles, it's compositing manager, am I right? Yes. Bin ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Get signals and callbacks.
On Tue, 2008-02-26 at 14:19 +0100, Germán Diago wrote: Hello. I'm implementing an application in gtkmm. I want to add support for dynamic signal connection from a glade file in C++ (which is not supported by the C++ bindings). I'd like to know if there is a way, once a glade file has been instantiated, to obtain information about the signals and handlers attached to every widget from the Gobject objects and how I should do it. I tried to do like this: guint nids = 0; guint * ids = g_signal_list_ids(g_type_from_name(GtkButton), nids); std::cout nids std::endl; std::cout g_signal_name(ids[23]) std::endl; but if I use GtkButton, nids == 0. However, when I use GtkWidget I get a 67 and signals can be get with the function g_signal_names(ids[i]); This code is to get available signals, but not the real connections between objects. Can help, please? The get_signals() code here might provide some hints: http://svn.gnome.org/viewvc/glibmm/trunk/tools/extra_defs_gen/generate_extra_defs.cc?view=markup I am not at all optimistic that we can do autoconnection, but I am happy that you are trying. -- [EMAIL PROTECTED] www.murrayc.com www.openismus.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Fwd: Get signals and callbacks.
-- Forwarded message -- From: Germán Diago [EMAIL PROTECTED] Date: 26-feb-2008 17:45 Subject: Re: Get signals and callbacks. To: [EMAIL PROTECTED] 2008/2/26, Germán Diago [EMAIL PROTECTED]: 2008/2/26, Murray Cumming [EMAIL PROTECTED]: On Tue, 2008-02-26 at 14:19 +0100, Germán Diago wrote: Hello. I'm implementing an application in gtkmm. I want to add support for dynamic signal connection from a glade file in C++ (which is not supported by the C++ bindings). I'd like to know if there is a way, once a glade file has been instantiated, to obtain information about the signals and handlers attached to every widget from the Gobject objects and how I should do it. I tried to do like this: guint nids = 0; guint * ids = g_signal_list_ids(g_type_from_name(GtkButton), nids); std::cout nids std::endl; std::cout g_signal_name(ids[23]) std::endl; but if I use GtkButton, nids == 0. However, when I use GtkWidget I get a 67 and signals can be get with the function g_signal_names(ids[i]); This code is to get available signals, but not the real connections between objects. Can help, please? The get_signals() code here might provide some hints: http://svn.gnome.org/viewvc/glibmm/trunk/tools/extra_defs_gen/generate_extra_defs.cc?view=markup I am not at all optimistic that we can do autoconnection, but I am happy that you are trying. -- [EMAIL PROTECTED] www.murrayc.com www.openismus.com Maybe a better way would be to parse the glade file itself and extract the info from there. But this way I cannot get introspection info about the type of the parameters and so on to be able to check if the connected slots are compatibles with the signal. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Text View Complaining about Double Free or Corruption
On Tue, 2008-02-26 at 01:20 -0500, Mark Rodriguez wrote: Was wondering if anybody has any idea(s) why the code below would seem to work fine on GTK/X11 (at least I don't see any error messages), but fail on GTK/DirectFB? When the application is exited by hitting the Quit button, I receive the following error message: *** glibc detected *** TextDemo: double free or corruption (out): 0x4035b1b0 *** I'm trying to figure out if this is a GTK related problem (i.e., I'm doing something wrong with GTK) or a problem with GTK/DirectFB. Thanks in advance for any suggestions / help. You are doing something wrong with GTK although it may or may not be the cause of the problem. The destroy handler should have a void return type. (You are probably confusing the return value with that for the delete event issue by the window manager.) Chris ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Text View Complaining about Double Free or Corruption
On Tue, 2008-02-26 at 20:51 -0500, Mark Rodriguez wrote: James, I'm not sure what in your #include common.h, but I placed the following in mine #include stdlib.h /* for abort() */ #include gtk/gtk.h /* for gtk, gdk, and glib */ I have a few other things, but these are included and the app also build fine for me. I can even run it under Ubuntu and it behaves exactly as I'd expect. It was pointed ou With that single change the program compiled and executed without error message; as I would have expected. Thanks for taking to time to respond. I too can compile and run the application without any problems under Ubuntu; however, when I run the same application cross compiled under DirectFB/GTK, it complains about double free / corruption. It was pointed out the my destroy handler should actually be defined to return void, but this didn't seem to affect anything. The destroy handler is an GObject handler that is signaled almost as the last logical breath before the object is removed from active memory. I can see no problem using this shutdown method and I have used the same method in 10s of multi-threaded programs. This might be worth a try. g_signal_connect (G_OBJECT (main_window), destroy, G_CALLBACK (gtk_main_quit), NULL); i.e. take the fastest way out, reducing stack overhead. The crazy thing is that I only get this error when adding a text view. All other widgets (buttons, pop-ups, labels, sliders, etc.) seem to work just fine. Is there anything different about a text view and calling gtk_widget_destroy on it's parent? Should I destroy the text view explicitly instead of relying on the parent to clean things up? Perhaps I should handle things myself and follow some special or preferred order when destroying the text view within the window? No special or preferred method that I am aware of, and I use text_view all the time. Contextually, your problem must should be related to your Direct/FB setup, rather than GTK internals. However, I am not an expert just an experienced long time user. When doe s the error occur? 0. When program starts 1. When shutting down 2. When creating the text_view the first time 3. When creating the text_view the Nth time I will assume it happens durin shutdown (#1). I assume the text view can be handled just like any other widget, but there appears to be something special or different about it. Yes, it should be handled like any other widget. The only special thing is its text_buffer! Consider gtk_text_view_new_with_buffer(), one is created automatically for when using the gtk_text_view_new() api. I don't think creating the GtkTextBuffer first would make any difference -- however, that where you are now. So try creating the GtkTextBuffer first, then use the ...with_buffer() api to create the view. This may produce a different result. If all else fails, try using gdb to get a backtrace to see which modules/api generated that error message. Again, thanks. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list