Re: GTK Widget assertion problem
In case anyone's interested I solved the problem with a little hack. I create the progress bar this way: progBar = gtk_progress_bar_new(); gtk_box_pack_start (GTK_BOX (vboxGr), GTK_PROGRESS_BAR(progBar), FALSE, FALSE, 0); gtk_widget_show (progBar)); progressBarHack(progBar); the function progressBarHack() looks like this: void progressBarHack(GtkWidget* bar) { progBar = bar; } progBar is a global variable. I get an assertion error when I try to work with it outside the function where the bar was created. When I use my hack, which does nothing except some pointer work, everything works fine. I don't know why the hack was needed because I've worked with several widgets with no problems at all. But this thing works. Cheerz, Michael ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK Widget assertion problem
On Thu, Jun 10, 2010 at 01:31:33PM +0200, Michael T. wrote: In case anyone's interested I solved the problem with a little hack. I create the progress bar this way: progBar = gtk_progress_bar_new(); gtk_box_pack_start (GTK_BOX (vboxGr), GTK_PROGRESS_BAR(progBar), FALSE, FALSE, 0); gtk_widget_show (progBar)); progressBarHack(progBar); the function progressBarHack() looks like this: void progressBarHack(GtkWidget* bar) { progBar = bar; } progBar is a global variable. I get an assertion error when I try to work with it outside the function where the bar was created. When I use my hack, which does nothing except some pointer work, everything works fine. I don't know why the hack was needed because I've worked with several widgets with no problems at all. But this thing works. Hello, this all looks like utter voodoo. You have probably a trivial bug somewhere (elsewhere) in your code, maybe some extern/static/initialization confusion? Or you overwrite the stack and calling progressBarHack() causes a change of the layout so that you overwrite a less sensitive place now? Anyway, it is recommended fix to avoid global variables, they are evil, and externs are double-evil. But perhaps if you show a minimal *complete* example that exhibits the error some will be able to help you. Or, likely, you will find the root cause while trying to extract the bad behaviour into a simple example... Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GKeyFile memory leak on Windows ?
Fixed now in git, bug #621168. --tml ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK Widget assertion problem
Hi, Hello, this all looks like utter voodoo. Yes it does. I tried 10 other ways and they didn't work. This one works perfectly (so far). You have probably a trivial bug somewhere (elsewhere) in your code, maybe some extern/static/initialization confusion? All initialization was shown in the previous examples. All my initializations are taken directly from the GTK+ documentation and I never had one problem. More people have been developing this very same application and there was no problem until I needed to work with the progress bar widget. There is no static identifier used because it is not needed. The extern identifier is used only, when the widget is accessed from other files which is precisely what this identifier was designed for. Or you overwrite the stack and calling progressBarHack() causes a change of the layout so that you overwrite a less sensitive place now? progressBarHack() does nothing with the layout. All it does is a proper initialization of the global variable which should work without the hack, but doesn't. Anyway, it is recommended fix to avoid global variables, they are evil, and externs are double-evil. Why? I've personally read the first book on C called The C programming language from 1978 written by the inventor of the language and using global variables is explained there as a proper way to implement things. I wonder what is the source of the 'evil global variables' legend, but if I'm wrong, please correct me. The extern identifier is just a way to access the global variable from a different file. I don't see why it should be a double-evil. But perhaps if you show a minimal *complete* example that exhibits the error some will be able to help you. Or, likely, you will find the root cause while trying to extract the bad behaviour into a simple example... I tried to do so in my first email (not the one you responded to). I also mentioned that I use several widgets as global variables because I need to access them from multiple functions. Hence, callbacks are not sufficient, in my opinion. There was never one problem with using widgets as global variables and the application uses a lot of them. That's why I think there's a problem particularly with the Progress bar widget. My hack just initializes the global variable properly, all it does is re-initializing the global variable outside the current function stack. Anywayz, a another simple example: // global variables GtkWidget *combobox; GtkWidget *textField; GtkWidget *progBar; GtkWidget* create_main_window (void) { //necessary window initializations, vertical boxes, tables etc. combobox = gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX (combobox), (const char*) U/t); gtk_combo_box_append_text(GTK_COMBO_BOX (combobox), (const char*) Q/t); gtk_combo_box_set_active(GTK_COMBO_BOX (combobox), 0); gtk_widget_show(combobox); gtk_box_pack_start (GTK_BOX (vbox3), combobox, FALSE, FALSE, 0); textField = gtk_text_view_new (); gtk_widget_show (textField); gtk_table_attach_defaults(table, textField, 3, 5, 0, 1); progBar = gtk_progress_bar_new(); gtk_box_pack_start (GTK_BOX (vboxGr), GTK_PROGRESS_BAR(progBar), FALSE, FALSE, 0); gtk_widget_show (progBar); // progressBarHack(progBar); ... } All the widgets are used as global variables due to reasons I have explained. All of them work perfectly and can be accessed from various functions except the progress bar widget. With the hack, progress bar works perfectly, too. There are about twenty or more widgets in the application that are used the same way - as global variables, there's never been one single problem. Please correct me, if I'm wrong anywhere. Thanks, Michael ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GTK+ 2.21.2 released
GTK+ 2.21.2 is now available for download at: ftp://ftp.gtk.org/pub/gtk/2.21/ http://download.gnome.org/sources/gtk+/2.21/ 48f0466e8149159523cd999f6b12561e3ba9e9d3effd5927641d80f8c9f83fdd gtk +-2.21.2.tar.bz2 17ba1e1ef1122be9e845a1d1e520b82a3a7d5231365956e7c7754312f28aa5c3 gtk +-2.21.2.tar.gz This is the third development release leading toward 2.22. Notes: * GTK+ 2.22 is planned to be the last stable GTK+ 2.x release, to be released in parallel with GTK+ 3. It will not receive major feature work beyond API additions that are required to facilitate porting to GTK+ 3. * Installing this version will overwrite your existing copy of GTK+ 2.20. If you have problems, you'll need to reinstall GTK+ 2.20. * GTK+ 2.22 will be source and binary compatible with the GTK+ 2.20 series; however, the new API additions are not yet finalized, so there may be incompatibilities between this release and the final 2.22 release. * Bugs should be reported to http://bugzilla.gnome.org. What is GTK+ GTK+ is a multi-platform toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK+ is suitable for projects ranging from small one-off tools to complete application suites. GTK+ has been designed from the ground up to support a range of languages, not only C/C++. Using GTK+ from languages such as Perl and Python (especially in combination with the Glade GUI builder) provides an effective method of rapid application development. GTK+ is free software and part of the GNU Project. However, the licensing terms for GTK+, the GNU LGPL, allow it to be used by all developers, including those developing proprietary software, without any license fees or royalties. Where to get more information about GTK+ Information about GTK+ including links to documentation can be found at: http://www.gtk.org/ An installation guide for GTK+ 2.x is found at: http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html Common questions: http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html http://www.gtk.org/faq/ Contributing GTK+ is a large project and relies on voluntary contributions. We are actively searching for new contributors in various areas and invite everyone to help project development. If you are willing to participate, please subscribe to the project mailing lists to offer your help and read over our list of vacant project tasks: http://live.gnome.org/GtkTasks Overview of Changes from GTK+ 2.21.1 to 2.21.2 == * The newly added gdk_drag_context_get_action function has been renamed to gdk_drag_context_get_selected_action to make the name less confusing. * Introspection annotations have been added in many places * New accessors for sealed struct members: gtk_viewport_get_view_window gdk_drag_context_get_source_window * Bug fixes: 608218 GtkOffscreenWindow causes bad window with GtkEntry 611709 Add gtk_statusbar_remove_all 596428 GtkAssistant: Support ending with a progress page 620511 Use g_source_set_name for all custom GSources in GTK+ 608537 Make the file chooser's sort arrows consistent 620863 Unable to select GtkMenu item above the current one... Thanks to all contributors: Cody Russell Garret Regier Didier Roche Michael Natterer Colin Walters Javier Jardón Stanislas Marquis John Palmieri Steve Frécinaux Hib Eris Federico Mena Quintero Benjamin Otte Cosimo Cecchi June 8, 2010 Matthias Clasen ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Gtk-CRITICAL - getting meaningful information
I've been using gtk for a while and frequently get messages like this: (nuchimp2:2621): Gtk-CRITICAL **: gtk_text_view_get_buffer: assertion `GTK_IS_TEXT_VIEW (text_view)' failed some times I can stumble over the cause and solution but the rest of the time I'm left to blindly grope around in the dark. Is there any way to get something meaningful that will point to a real world location. I assume the :2621 points to a location in the code but two successive compilations with the source unchanged (eg: make clean; make; make install; run; make clean; make; make install; run) results in a different number. I used glade to define the interface: ... object class=GtkWindow id=chimp_window property name=title translatable=yesChimp for chatmunkees/property property name=default_width640/property property name=default_height400/property property name=iconpixmaps/chimp2.xpm/property signal name=destroy handler=gtk_main_quit/ child object class=GtkVBox id=vbox1 property name=visibleTrue/property property name=orientationvertical/property ... child object class=GtkNotebook id=notebook1 property name=visibleTrue/property property name=can_focusTrue/property child object class=GtkVBox id=vbox2 property name=visibleTrue/property property name=orientationvertical/property child object class=GtkHPaned id=hpaned1 property name=visibleTrue/property property name=can_focusTrue/property child object class=GtkTextView id=chat_view property name=visibleTrue/property property name=can_focusTrue/property property name=bufferchat_buffer/property /object packing property name=resizeTrue/property property name=shrinkFalse/property /packing /child ... /object packing property name=position0/property /packing /child ... object class=GtkTextTagTable id=chattexttagtable/ ... object class=GtkTextBuffer id=chat_buffer property name=tag_tablechattexttagtable/property /object /interface the code snippet this particular instance comes from is: GtkTextView *chat_view; GtkTextBuffer *chat_buffer; GtkTextIter start, end; GtkTextIter iter; main() { ... chimp_window = GTK_WIDGET(gtk_builder_get_object(builder, chimp_window)); gtk_builder_connect_signals(builder, NULL); gtk_widget_show(chimp_window); chat_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(chat_view)); gtk_text_buffer_create_tag(chat_buffer, blue_fg, foreground, blue, NULL); gtk_text_buffer_insert_with_tags_by_name(chat_buffer, iter, Colored Text\n, -1, blue_fg, lmarg, NULL); ... } which gives these: (nuchimp2:2621): Gtk-CRITICAL **: gtk_text_view_get_buffer: assertion `GTK_IS_TEXT_VIEW (text_view)' failed (nuchimp2:2621): Gtk-CRITICAL **: gtk_text_buffer_create_tag: assertion `GTK_IS_TEXT_BUFFER (buffer)' failed (nuchimp2:2621): Gtk-CRITICAL **: gtk_text_buffer_insert_with_tags_by_name: assertion `GTK_IS_TEXT_BUFFER (buffer)' failed the tarball of the package (the small part I've done so far) can be d/l from http:/www.junkyardalchemy.org/nuchimp2-0.1.tar.gz in case I've snipped something critical. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list