[Gambas-user] Issue 311 in gambas: Object.GetProperty is mangling objects
gambas at ...2524...
gambas at ...2524...
Thu Aug 16 04:42:40 CEST 2012
Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Other Arch-Any
Desktop-Any GUI-Any
New issue 311 by adamn... at ...626...: Object.GetProperty is mangling objects
http://code.google.com/p/gambas/issues/detail?id=311
1) Describe the problem.
Possible bug?
Very hard to describe. Something in the attached project causes
Object.GetProperty to change the object it is working with. This causes
differing problems on nearly every run. Segfaults, aborts, or just very odd
behaviour.
It may have something to do with the fact that the faulting object is using
a database?
:-( Sorry Benoit, I just can't characterise this one any further.
2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):
Version: TRUNK
Revision: r5043
Operating system: Linux
Distribution: PCLinuxOS
Architecture: x86
GUI component: QT4 / GTK+
Desktop used: LXDE
3) Provide a little project that reproduces the bug or the crash.
Attached
4) If your project needs a database, try to provide it, or part of it.
SQLite db contained in attached project.
5) Explain clearly how to reproduce the bug or the crash.
The attached project is a "hacked down" version of one of our production
projects that lets horse trainers offer their horses in an upcoming
auction. It is the smallest I can get it and reproduce the issue. (Note
the production version uses a postgres database and the same thing occurs,
so it's not sqlite that does it.)
The attached consists of a main form and three object classes. The form
has two gridviews, one for the horses (object class "Stable") and one for
the upcoming auctions (object class "Auction". The Auctions class uses
the "House" class to get and provide information about an auctioneering
company. The Stable class is independent of any database interaction.
As provided, the project runs correctly, just so you can see what is
supposed to happen. The problem area is highlighted in the FMain code at
the LoadGrid method.
So,
1) Open it in the IDE and run it, you should see the upper gridview
populated with 4 horses and the lower gridview populated with 5 auctions
(sorted by date, state and code).
2) At line 85 in FMain.LoadGrid, I am doing something a bit strange in
order to show that Object.GetProperty works fine in the case where the
Object has no database interaction.
3) Lines 90 to 135, which is where the problem lies, is creating a sorted
list of objects in the collection of upcoming auctions and then loading the
bottom gridview according to that sort list. The sort order in the demo is
defined as an inline array at line 94 (in the prod version it is a dynamic
String[]). Lines 98-105 get the sortkey components directly, this works.
4) Line 108, (commented out) attempts to get the sortkey components using
Object.Getproperty. This would generalise the method and allow the users
to set any sort order they want.
To demonstrate the problem.
1) Comment out lines 98-105 and uncomment line 108.
2) Re-run the project.
3) You should see any one of any number of "crashes".
This is what I can see:
1) This is the most common occurrence
a) set a breakpoint on line 108 and popup a debug window on "hCurrAuction"
b) stepping through the code, when I get to the third iteration and it is
accessing the "HouseCode" property, suddenly the debugger shows junk in the
hCurrAuction object. When we get to line 119, the hCurrAuction property
values are again changed and at line 120 the resultant sortkey is junk.
Stepping to line 121, the hCurrentAuction properties change again!
2) Sometimes, for Lord knows what reason. It gets through to line 132
without an error. Then it segfaults at any one of the lines 151-156
Sorry about the long description and for the lack of any further
characterisation.
Bruce
Attachments:
gvwprob-0.0.1.tar.gz 8.5 KB
More information about the User
mailing list