* Errors using gtk.font_button in gtkada (gtk3) @ 2019-02-11 23:04 Gavin McCord 2019-02-11 23:45 ` Dmitry A. Kazakov 0 siblings, 1 reply; 8+ messages in thread From: Gavin McCord @ 2019-02-11 23:04 UTC (permalink / raw) Strange one here, at least to me. I'm running Slackware 14.2, using the XFCE 4.12 desktop environment and GNAT 2018 (though I've encountered this problem with an older version of GNAT also). I created a small program "test" to take input from a GEntry and insert it into a Text_View. It doesn't do much else, but works okay. Since then I've added a Font_Button to allow the user to change the font within the Text_View. I get an error though when I click on the font button for the first time: "(test:2564): Gtk-CRITICAL **: gtk_tree_model_filter_real_unref_node: assertion 'elt->ref_count > 0' failed" But the program, font selection included, still works as expected. Now all this is using a custom GTK3 theme, based on the built-in Raleigh. If I then change the theme to Adwaita I get subsequent errors and the program exits, as follows. I start the program, and click the Font_Button. The above error occurs, as before. At this point I can still select a font and it changes the text in the Text_View accordingly. But if I then try to change the font a second time, at the point when I click the Font_Button the following additional errors appear and the program exits: "(test:3481): Gtk-CRITICAL **: gtk_list_store_get_value: assertion 'iter_is_valid (iter, list_store)' failed (test:3481): GLib-GObject-WARNING **: ../../src/gobject/gtype.c:4268: type id '0' is invalid (test:3481): GLib-GObject-WARNING **: can't peek value table for type '<invalid>' which is not currently referenced raised STORAGE_ERROR : stack overflow or erroneous memory access I suspect this is not going to be easy to diagnose as searches for these errors previously hasn't brought me anything particularly similar to my situation. But any thoughts, pointers would be gratefully received. Gavin ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Errors using gtk.font_button in gtkada (gtk3) 2019-02-11 23:04 Errors using gtk.font_button in gtkada (gtk3) Gavin McCord @ 2019-02-11 23:45 ` Dmitry A. Kazakov 2019-02-13 21:26 ` Gavin McCord 0 siblings, 1 reply; 8+ messages in thread From: Dmitry A. Kazakov @ 2019-02-11 23:45 UTC (permalink / raw) On 2019-02-12 00:04, Gavin McCord wrote: > Strange one here, at least to me. > > I'm running Slackware 14.2, using the XFCE 4.12 > desktop environment and GNAT 2018 (though I've > encountered this problem with an older version > of GNAT also). > > I created a small program "test" to take input > from a GEntry and insert it into a Text_View. It > doesn't do much else, but works okay. > > Since then I've added a Font_Button to allow the > user to change the font within the Text_View. > > I get an error though when I click on the font > button for the first time: > > "(test:2564): Gtk-CRITICAL **: > gtk_tree_model_filter_real_unref_node: assertion > 'elt->ref_count > 0' failed" GTK deploys reference counting. It is a very tricky and difficult to understand. GTK widgets have so-called "floating" reference when created. A floating reference is converted into a normal reference when the widget is put into a container. It is done to spare one line of code needed to decrement the reference in the sequences like: Gtk_New (Child); Box.Pack_Start (Child); [ Unref (Child) ] But all other objects are created with normal reference count 1 and need to be released using Unref when put somewhere. You seem mess up with references. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Errors using gtk.font_button in gtkada (gtk3) 2019-02-11 23:45 ` Dmitry A. Kazakov @ 2019-02-13 21:26 ` Gavin McCord 2019-02-13 22:02 ` Dmitry A. Kazakov 0 siblings, 1 reply; 8+ messages in thread From: Gavin McCord @ 2019-02-13 21:26 UTC (permalink / raw) No, that makes sense, but I must be missing something really obvious. I've simplified the code so there's only a button, a label and the font_button, with one main program file and a callback package (see below), though the font_button isn't even connected to a handler at this point, the error still occurs when it's clicked on. test2.adb --------- with Gtk.Main; with Gtk.Window; use Gtk.Window; with Gtk.Box; use Gtk.Box; with Gtk.Widget; use Gtk.Widget; with Gtk.Button; use Gtk.Button; with Gtk.Font_Button; use Gtk.Font_Button; with Gtk.Label; use Gtk.Label; with Gtkada.Handlers; use Gtkada.Handlers; with Test2_Cb; use Test2_Cb; procedure Test2 is Win : Gtk_Window; Vert_Box : Gtk_VBox; Button : Gtk_Button; FontButton : Gtk_Font_Button; Label : Gtk_Label; begin Gtk.Main.Init; Gtk_New (Win); Win.Set_Default_Size (480, 160); Win.Set_Title ("FontButton test"); Win.On_Destroy (Main_Quit'Access); Gtk_New_VBox (Vert_Box, False, 0); Win.Add (Vert_Box); Gtk_New (Label, "A label."); Pack_Start (Vert_Box, Label, True, False, 0); Gtk_New (FontButton); Pack_Start (Vert_Box, FontButton, True, False, 0); Gtk_New (Button, "Quit"); Widget_Callback.Object_Connect (Button, "clicked", Widget_Callback.To_Marshaller (Button_Quit'Access), Win); Pack_Start (Vert_Box, Button, True, False, 0); Win.Show_All; Gtk.Main.Main; end Test2; ---------- test2_cb.adb ------------ package body Test2_Cb is procedure Main_Quit (Self : access Gtk_Widget_Record'Class) is begin Gtk.Main.Main_Quit; end Main_Quit; procedure Button_Quit (Self : access Gtk_Widget_Record'Class) is begin Destroy (Self); end Button_Quit; end Test2_Cb; ------------- test2_cb.ads ------------ with Gtk.Main; with Gtk.Widget; use Gtk.Widget; package Test2_Cb is procedure Main_Quit (Self : access Gtk_Widget_Record'Class); procedure Button_Quit (Self : access Gtk_Widget_Record'Class); end Test2_Cb; ------------- ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Errors using gtk.font_button in gtkada (gtk3) 2019-02-13 21:26 ` Gavin McCord @ 2019-02-13 22:02 ` Dmitry A. Kazakov 2019-02-13 23:22 ` Gavin McCord 0 siblings, 1 reply; 8+ messages in thread From: Dmitry A. Kazakov @ 2019-02-13 22:02 UTC (permalink / raw) On 2019-02-13 22:26, Gavin McCord wrote: > > No, that makes sense, but I must be missing something > really obvious. I've simplified the code so there's > only a button, a label and the font_button, with one > main program file and a callback package (see below), > though the font_button isn't even connected to a > handler at this point, the error still occurs when > it's clicked on. Works OK with GtkAda 3.14.15. What version do you have? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Errors using gtk.font_button in gtkada (gtk3) 2019-02-13 22:02 ` Dmitry A. Kazakov @ 2019-02-13 23:22 ` Gavin McCord 2019-02-13 23:42 ` Gavin McCord 0 siblings, 1 reply; 8+ messages in thread From: Gavin McCord @ 2019-02-13 23:22 UTC (permalink / raw) On Wed, 13 Feb 2019 23:02:04 +0100, Dmitry A. Kazakov wrote: > > > Works OK with GtkAda 3.14.15. What version do you have? 3.18.9. Too new? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Errors using gtk.font_button in gtkada (gtk3) 2019-02-13 23:22 ` Gavin McCord @ 2019-02-13 23:42 ` Gavin McCord 2019-02-14 8:26 ` Dmitry A. Kazakov 0 siblings, 1 reply; 8+ messages in thread From: Gavin McCord @ 2019-02-13 23:42 UTC (permalink / raw) On Wed, 13 Feb 2019 23:22:15 +0000, Gavin McCord wrote: > On Wed, 13 Feb 2019 23:02:04 +0100, Dmitry A. Kazakov wrote: > > >> >> Works OK with GtkAda 3.14.15. What version do you have? > > 3.18.9. Too new? Correction, that's the version distributed with Slackware 14.2, the version included with GNAT *is* 3.14.15. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Errors using gtk.font_button in gtkada (gtk3) 2019-02-13 23:42 ` Gavin McCord @ 2019-02-14 8:26 ` Dmitry A. Kazakov 2019-02-14 23:31 ` Gavin McCord 0 siblings, 1 reply; 8+ messages in thread From: Dmitry A. Kazakov @ 2019-02-14 8:26 UTC (permalink / raw) On 2019-02-14 00:42, Gavin McCord wrote: > On Wed, 13 Feb 2019 23:22:15 +0000, Gavin McCord wrote: > >> On Wed, 13 Feb 2019 23:02:04 +0100, Dmitry A. Kazakov wrote: >>> >>> Works OK with GtkAda 3.14.15. What version do you have? >> >> 3.18.9. Too new? > > Correction, that's the version distributed with Slackware 14.2, > the version included with GNAT *is* 3.14.15. Does Slackware distribute GtkAda, or 3.18.9 is the version of GTK itself? GtkAda 3.14.15 is what AdaCore published with the GNAT GPL (or community edition they call it now). They also have a repository where one can get the latest changes. Also, GTK is full of bugs that come and go. Recently I had a massive memory leak in one version fixed in another. Memory leakage has a direct connection to reference counting, so I would think it might be a GTK problem, first. You could try to upgrade or downgrade and see if the bug persists. GtkAda usually stays compatible with a number of GTK version. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Errors using gtk.font_button in gtkada (gtk3) 2019-02-14 8:26 ` Dmitry A. Kazakov @ 2019-02-14 23:31 ` Gavin McCord 0 siblings, 0 replies; 8+ messages in thread From: Gavin McCord @ 2019-02-14 23:31 UTC (permalink / raw) Slackware only comes with basic Ada support for GCC. I'm presuming it's an old version of the FSF GNAT. I don't install that. I downloaded and installed myself, GNAT and Gtkada from AdaCore. I'd love if it were part of the distribution but I think that pretty unlikely. I might see if I can downgrade. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-02-14 23:31 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-02-11 23:04 Errors using gtk.font_button in gtkada (gtk3) Gavin McCord 2019-02-11 23:45 ` Dmitry A. Kazakov 2019-02-13 21:26 ` Gavin McCord 2019-02-13 22:02 ` Dmitry A. Kazakov 2019-02-13 23:22 ` Gavin McCord 2019-02-13 23:42 ` Gavin McCord 2019-02-14 8:26 ` Dmitry A. Kazakov 2019-02-14 23:31 ` Gavin McCord
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox