[gtkada] gtkada Digest, Vol 113, Issue 6

Rob Groen robgr at xs4all.nl
Mon Jun 30 17:36:53 CEST 2014


 

Thanks for trying 

I applied the patch on Win7-64, i.e. I declared and used a procedure
My_Set with the same code as in the patch, but the problem persists. 

Regards, Rob 

On 2014-06-30 12:00, gtkada-request at lists.adacore.com wrote: 

> Send gtkada mailing list submissions to
> gtkada at lists.adacore.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.adacore.com/mailman/listinfo/gtkada [2]
> or, via email, send a message with subject or body 'help' to
> gtkada-request at lists.adacore.com
> 
> You can reach the person managing the list at
> gtkada-owner at lists.adacore.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gtkada digest..."
> 
> Today's Topics:
> 
> 1. Memory allocation issue in GtkAda 3.8 ? (Rob Groen)
> 2. Re: Memory allocation issue in GtkAda 3.8 ? (Dmitry A. Kazakov)
> 3. Re: Memory allocation issue in GtkAda 3.8 ? (Emmanuel Briot)
> 
> Hello all, 
> 
> As a follow up on the discussion last March wrt memory allocation problems in GtkAda 3.x, I tried one of my failing programs with Gtkada 3.8. Unfortunately with the same result. 
> 
> I tried this on Windows 7, both on a 64- and on a 32-bit environment, using the GNAT GPL 2014 compiler. In order to track the problem I stripped my original application to a simple window with a treeview / liststore, consisting of one column of type Gtype_String. The liststore gets loaded with a nr of strings, then a search in the store is performed. In the search a Get_String is done on an element of the store. 
> 
> When an allocator is used prior searching ( sp := new String'("") ), the program crashes after a few searches. When either the allocator or the Get_String is omitted the program runs to completion.
> (The nr of strings to put into the store and the nr of searches vary with the code, logging statements, etc etc. The current nrs are those that crashes the program in my environments, Win7 32- and 64-bit.) 
> 
> For those who want to research / replay this issue a zip file with the code and a .gpr file can be found at: http://robgr.home.xs4all.nl/gtkada3x_bug.zip. The "offending" code is in the file gtkada3x_bug_support.adb.
> Unfortunately I do not have the knowledge to research this problem. 
> 
> If there are problems downloading, let me know, then I will send the zip file. 
> 
> Best regards 
> 
> Rob Groen 
> 
> (PS I hope that it is not something in my code... that would be so embarrassing. I have looked it over and over umpteen times.) 
> 
> List-Post: <mailto:gtkada at lists.adacore.com>
> Content-Transfer-Encoding: 7bit
> From: "Dmitry A. Kazakov" <mailbox at dmitry-kazakov.de>
> Precedence: list
> MIME-Version: 1.0
> To: gtkada <gtkada at lists.adacore.com>
> References: <b9bb2291b539eafe1e36e900d7f7a962 at xs4all.nl>
> In-Reply-To: <b9bb2291b539eafe1e36e900d7f7a962 at xs4all.nl>
> Date: Sun, 29 Jun 2014 19:30:56 +0200
> Reply-To: mailbox at dmitry-kazakov.de
> Message-ID: <13y4survzppgu$.x75d9ksthujh.dlg at 40tude.net>
> Content-Type: text/plain; charset="us-ascii"
> Subject: Re: [gtkada] =?utf-8?q?Memory_allocation_issue_in_GtkAda_3=2E8_=3F?=
> Message: 2
> 
> On Sun, 29 Jun 2014 18:11:33 +0200, you wrote:
> 
>> As a follow up on the discussion last March wrt memory allocation problems in GtkAda 3.x, I tried one of my failing programs with Gtkada 3.8. Unfortunately with the same result. I tried this on Windows 7, both on a 64- and on a 32-bit environment, using the GNAT GPL 2014 compiler. In order to track the problem I stripped my original application to a simple window with a treeview / liststore, consisting of one column of type Gtype_String. The liststore gets loaded with a nr of strings, then a search in the store is performed. In the search a Get_String is done on an element of the store. When an allocator is used prior searching ( sp := new String'("") ), the program crashes after a few searches. When either the allocator or the Get_String is omitted the program runs to completion. (The nr of strings to put into the store and the nr of searches vary with the code, logging statements, etc etc. The current nrs are those that crashes the program in my environments, Win7 32- a!
 nd
64-bit.) For those who want to research / replay this issue a zip file with the code and a .gpr file can be found at: http://robgr.home.xs4all.nl/gtkada3x_bug.zip [1]. The "offending" code is in the file gtkada3x_bug_support.adb. Unfortunately I do not have the knowledge to research this problem.
> 
> If I correctly remember, I might be wrong, the problem is with the Set
> procedure of Gtk_List_Store with a string argument.
> 
> A workaround is to use Set_Value instead. You do Init of a GValue with
> GType_String. Set the string into it. Then Set_Value to update the list
> store and, finally, Unset the GValue object.
> 
> For those who want to research / replay this issue a zip file with the code and a .gpr file can be found at: http://robgr.home.xs4all.nl/gtkada3x_bug.zip [1]. The "offending" code is in the file gtkada3x_bug_support.adb. Unfortunately I do not have the knowledge to research this problem.

I tried running on my machine (OSX), including with valgrind, but could
reproduce
neither a crash nor an error reported by valgrind (but valgrind is
pretty bad on OSX,
so this might not be exactly accurate).

That said, I would agree with Dmitry that the implementation of
Gtk.List_Store.Set
might be incorrect, and it would be better to convert to a GValue first.

Can you try applying the following patch ?

_______________________________________________
gtkada mailing list
gtkada at lists.adacore.com
http://lists.adacore.com/mailman/listinfo/gtkada [2]

 

Links:
------
[1] http://robgr.home.xs4all.nl/gtkada3x_bug.zip
[2] http://lists.adacore.com/mailman/listinfo/gtkada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/gtkada/attachments/20140630/78379f3a/attachment.html>


More information about the gtkada mailing list