[gtkada] Examples global improvement patch proposals.

Pascal p.p14 at orange.fr
Mon Aug 6 22:15:28 CEST 2012


Hello Emmanuel,

a) In test_display_switch, I didn't see that the GTK.Main was in a no ending loop, so I've added a flag to quit the loop, see attached file.

b) Yes you were right, the message is only concerning My_Destroy2, so I moved exception handler, see attached file and test:
$ ./test_handlers.1 
My_Destroy
My_Destroy2
My_Destroy3
My_Destroy4
My_Destroy2
Exception name: CONSTRAINT_ERROR
Message: erroneous memory access

If you don't destroy the callback at the sametime, then the next time the callback is called it will try to access some invalid memory (Object being destroyed) and you will likely get an error.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20120806-examples.diff
Type: application/octet-stream
Size: 3941 bytes
Desc: not available
URL: </pipermail/gtkada/attachments/20120806/5e40ecef/attachment.obj>
-------------- next part --------------


Thanks for feedback, Pascal.
http://blady.pagesperso-orange.fr


Le 1 ao?t 2012 ? 15:23, Emmanuel Briot a ?crit :

>> 
>> a) Add a clean quit callback on window delete event:
> 
> The patch is incorrect. You are not supposed to call Gtk.Main.Main_Quit yourself, just return False from the delete_event callback.
> Please attach the patches to your message, rather than paste them, to avoid copy-paste error and make it easier to apply the patch.
> 
> 
>> b) More understandable message on exception:
> 
> I do not understand this patch. Because of the call to Add_Watch, the callback should already be automatically disabled, and thus the message you put in your exception handler does not make sense.
> 
...
> 
> Patch applied
> 
> Emmanuel
> 



More information about the gtkada mailing list