From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.yTvCNOh9TRCAIcX40YItlQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Errors using gtk.font_button in gtkada (gtk3) Date: Tue, 12 Feb 2019 00:45:02 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: yTvCNOh9TRCAIcX40YItlQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:55496 Date: 2019-02-12T00:45:02+01:00 List-Id: 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