Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #6828 > unrolled thread
| Started by | "Philippe Bayard (Belgium)" <philbayard@gmail.com> |
|---|---|
| First post | 2014-05-02 02:28 -0700 |
| Last post | 2014-05-04 06:09 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
RegisterItem access violation "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2014-05-02 02:28 -0700
Re: RegisterItem access violation "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2014-05-02 02:37 -0700
Re: RegisterItem access violation Malcolm G <malcolm-news2012delete@delete.jobstream.com> - 2014-05-02 10:43 +0100
Re: RegisterItem access violation "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2014-05-02 03:05 -0700
Re: RegisterItem access violation D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2014-05-04 06:09 +0200
| From | "Philippe Bayard (Belgium)" <philbayard@gmail.com> |
|---|---|
| Date | 2014-05-02 02:28 -0700 |
| Subject | RegisterItem access violation |
| Message-ID | <3f7a0e6a-807d-4f46-b5d0-4a608ad0a2ec@googlegroups.com> |
Hi everyone.
In order to make an automatic traduction of our menu, we've surclassed our menu class. But sometimes, it happens that we get an access violation error on the registerItem line.
Error message:
--------------
Error Code: 50 [ ACCESS VIOLATION ]
Subsystem: VO-CODE
Error Subcode: 5333
Argument Number: 2
Description: Application Code Error causing Access Violation
CallStack:
MYMENU:REGISTERITEM (Line: 13)
Here the code :
METHOD RegisterItem(nItemID,oHyperLabel, nHandle, nPosition) CLASS MyMenu
LOCAL ctxt AS STRING
LOCAL oHyper as HyperLabel
if !IsNil(oHyperLabel:Caption) .and. !Empty(oHyperLabel:Caption)
ctxt := tradfunc("MENU_GLOBAL",oHyperLabel:Caption)
oHyper := HyperLabel{;
oHyperLabel:Name,;
iif ( IsNil(ctxt) .or. Empty(ctxt), null_string, ctxt) ,;
iif ( IsNil(oHyperLabel:description) .or. Empty(oHyperLabel:description), null_string, oHyperLabel:description) ,;
iif ( IsNil(oHyperLabel:HelpContext) .or. Empty(oHyperLabel:HelpContext), null_string, oHyperLabel:HelpContext) }
SUPER:RegisterItem(nItemID, oHyper, nHandle, nPosition)
else
SUPER:RegisterItem(nItemID, oHyperLabel, nHandle, nPosition)
endif
return self
I've read some topic about error 5333 in the newsgroup, and see some cases that can match our. Maybe the garbage collector is cleaning the Hyperlabel too fast and then the Register item is using an illegal references.
So i added these two line just after the initialise of the hyperlabel.
oHyper := DynToOldSpace(oHyper) //To static memory.
AAdd(self:aHyper, oHyper) // To free during destroy().
And freeing those in
method dESTROY() class MyMenu
LOCAL oHyper as HyperLabel
LOCAL i as DWORD
for i := 1 to ALen(self:aHyper)
oHyper := self:aHyper[i]
OldSpaceFree(oHyper)
next i
return super:dESTROY()
Is it for you a good way the handle this case? Do you have any advise if this is not a good way to do so?
Thanks for reading me and for any advise ;)
Philippe.
[toc] | [next] | [standalone]
| From | "Philippe Bayard (Belgium)" <philbayard@gmail.com> |
|---|---|
| Date | 2014-05-02 02:37 -0700 |
| Message-ID | <d9dcd91a-e9be-45ac-a808-8cd4d69f083b@googlegroups.com> |
| In reply to | #6828 |
I also forgot to say that i'm unable to reproduce this error in my environnement, but it happens sometimes. ( this is why i ask for advises about it, i must "think" of a solution for this cases without being able to try it and see if this works).
[toc] | [prev] | [next] | [standalone]
| From | Malcolm G <malcolm-news2012delete@delete.jobstream.com> |
|---|---|
| Date | 2014-05-02 10:43 +0100 |
| Message-ID | <YMJ8v.214334$yN1.50269@fx29.am4> |
| In reply to | #6828 |
> Is it for you a good way the handle this case? Do you have any advise if this is not a good way to do so? > > Thanks for reading me and for any advise ;) I assume you have already looked at the source of METHOD RegisterItem(nItemID, oHyperLabel, hParentMenu, nPosition) CLASS Menu in the VO SDK supplied? You don't say what version of VO you are using (for example the VO27 and Vulcan SDKs have a number of differences) I would often consider, for debugging, having a copy of the SDK - probably by a different method name - hooked into you code so you can see where in the SDK the error happens. I do worry a bit about what you expect to happen if the hyperlabel caption is empty.
[toc] | [prev] | [next] | [standalone]
| From | "Philippe Bayard (Belgium)" <philbayard@gmail.com> |
|---|---|
| Date | 2014-05-02 03:05 -0700 |
| Message-ID | <409ba929-70de-4de7-b0b8-86fe6d0ff63f@googlegroups.com> |
| In reply to | #6828 |
We're using VO28 SP3. I'm unable to reproduce it so it's hard to debug. But i will try switching to the SDK to see which line cause this.
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2014-05-04 06:09 +0200 |
| Message-ID | <f5fbm9ls5f6ro1710upvv8lb07keq2t0fq@4ax.com> |
| In reply to | #6828 |
On Fri, 2 May 2014 02:28:58 -0700 (PDT), "Philippe Bayard (Belgium)" <philbayard@gmail.com> wrote: Hello Philippe, >Error Code: 50 [ ACCESS VIOLATION ] >MYMENU:REGISTERITEM (Line: 13) There are lots of posts for 5333 errors but usually they are hard to solve. I would put an error handler around this code and see (log?) what happens when the error occurs. With a bit of luck, the menu is already built when the error is caught and your program just continues without the user noticing it. Dick
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web