error code 50

124 views
Skip to first unread message

aurora baccio

unread,
Jun 22, 2021, 8:51:04 AMJun 22
to
fternoon.
Here in Sicily it is 37 degrees Celsius.
My application presents an initial facade that is launched through this class
CLASS Mainwindow INHERIT ShellWindow

EXPORT oColour AS Color // The color object if selected
EXPORT Red AS INT
EXPORT Green AS INT
EXPORT Blue AS INT
PROTECT oSB AS StatusBar
PROTECT hBkGndBitMap AS PTR
EXPORT CaptionOK AS STRING

Here is the main menu with the method to exit the program. And it is here that I return all methods at the end of the procedures.
The initial mask is launched with the Launch method

METHOD Launch() CLASS MainWindow

LOCAL oWin as RichiestaCodiceFiscale_Maschera

PlaySound(String2Psz(pathname+"patients.wav"),null,SND_FILENAME+SND_ASYNC)

oWin := RichiestaCodiceFiscale_Maschera{self}
FabCenterWindow(oWin)
oWin:Show()

RETURN nil

In the launched mask (a data dialog) there are a whole series of quick procedures, including the launch of the dispensing of recipes by double-clicking from a sub data window. If I exit from this mask I should, by my logic, return to the initial, basic screen. This is what happens if I exit after performing any procedure other than double click. In this case you get the following error
ERROR CODE 50 ACCESS VIOLATION
.....
DESCRIPTION APPLICATION CODE ERRORCAUSIN ACCES VIOLATION
CALLSTACK:
MAINWINDOS LAUNCHES (LINE 13) (corresponds to : owin:show())
APP:START LINE 443
START: LINE 6
Can someone help me?
thanks
Aurora Baccio

Translated with www.DeepL.com/Translator (free version)

Wolfgang Riedmann

unread,
Jun 22, 2021, 10:14:49 AMJun 22
to
Hi Aurora,

> In the launched mask (a data dialog) there are a whole series of
> quick procedures, including the launch of the dispensing of recipes
> by double-clicking from a sub data window. If I exit from this mask I
> should, by my logic, return to the initial, basic screen. This is
> what happens if I exit after performing any procedure other than
> double click. In this case you get the following error ERROR CODE 50
> ACCESS VIOLATION ..... DESCRIPTION APPLICATION CODE ERRORCAUSIN
> ACCES VIOLATION CALLSTACK: MAINWINDOS LAUNCHES (LINE 13)
> (corresponds to : owin:show()) APP:START LINE 443 START: LINE 6

this may be difficult to find: a GPF like this is occurring most of the
time if you are accessing an object that is being destroyed.

Searching for a GPF cause can be really time consuming....

Wolfgang


--

aurora baccio

unread,
Jun 22, 2021, 2:33:47 PMJun 22
to
Good evening Mr. Riedman, and thank you always.
Your conclusion is my conclusion as well.
But the point is that I destroy (with theExit button) the RequestFiscalCode window and not the mainwindow.
I have tried both Destroy(9 and Endwindow().
And if I don't double click on the subdatawindow contained in the TaxCodeRequest window everything works normally.
And in any case the procedures activated with the double click are activated and closed regularly.
A question: what does GPF mean?
thanks
Aurora Baccio

Wolfgang Riedmann

unread,
Jun 23, 2021, 5:12:36 AMJun 23
to
Hi Aurora,

a GPF is a general protection failure - VO calls it "access violation".

It basically means that a process tries to access memory that is
outside of its memory space.
Since VO's memory is handled by its own dynamic memory system, normally
this means that the program tries to access objects that are already
destroyed.

Unfortunately I cannot say more without seeing the entire logic, but I
suspect that a reference to the RequestFiscalCode window is stored
somewhere and your code tries to access it nevertheless it is already
garbage collected.

A call to the Destroy() method should only be used in rare cases - it
was requested in earlier VO versions to cleanup Windows ressources like
fonts or pens. But you should never call the Destroy() method on a
window or control class.

Wolfgang
--

aurora baccio

unread,
Jun 23, 2021, 7:45:40 AMJun 23
to
Mr. Riedman good morning,
going by logic the problem arises only after double click in the subdatawindow

here is the method :
AAdd(aParam,self:Owner:Server:CodOperato)
AAdd(aParam,self:Owner:Server:CodFisc)
AAdd(aParam,4) // start from double click
AAdd(aParam,"")

DeleteChildWindow(self:Owner:Caption)
self:Owner:Destroy()

oMenuDemNew:=
oMenuDemNuovo_Maschera{self:Owner:Owner,,,aParam}
FabCenterWindow(oMenuDemNew)
oMenuDemNew:Show()

the incriminating part should be self:owner:destroy()
the first owner destroys the subdatawindow, the second one the datadialog. am I wrong?
thanks
Aurora Baccio

Wolfgang Riedmann

unread,
Jun 23, 2021, 11:12:04 AMJun 23
to
Hi Aurora,

as I wrote: never call Destroy() on a window.

> going by logic the problem arises only after double click in the
> subdatawindow
>
> here is the method :
01 > AAdd(aParam,self:Owner:Server:CodOperato)
02 > AAdd(aParam,self:Owner:Server:CodFisc)
03 > AAdd(aParam,4) // start from double click
04 > AAdd(aParam,"")
05 >
06 > DeleteChildWindow(self:Owner:Caption)
07 > self:Owner:Destroy()
08 >
09 > oMenuDemNew:=
10 > oMenuDemNuovo_Maschera{self:Owner:Owner,,,aParam}
11 > FabCenterWindow(oMenuDemNew)
12 > oMenuDemNew:Show()

this is clear (I have added numbers to the lines):
in line 07 you are calling Destroy() on self:Owner, so you are cleaning
it effectively up.
But in line 10 you are accessing a member of an already destroyed
window.

I see at least two possibilities:
- store the self:Owner:Owner to a local variable before destroying the
self:Owner and use this variable instead of the self:Owner:Owner
- store the shell window (this should be the self:Owner:Owner?) to a
sort of global and retrieve it always from them.

Wolfgang

--

aurora baccio

unread,
Jun 24, 2021, 9:58:58 AMJun 24
to
good morning,
I have come to the conclusion, I hope correct, that the source of my problems are these two lines of code contained in the double-click method
*DeleteChildWindow(self:Owner:Caption)
*self:Owner:Destroy()
as you can see they have been disabled and the problem has disappeared.
These two lines should destroy the whole mask named RequestFiscalCode, a data dialog in which there is the list of appointments of the day, displayed in a subdatawindow.
The first self:Owner should close the subData, while the second should close the datadialog, at least I think so since the entire mask disappears.
Once the two lines are deleted, the datadialog remains active, as does the subdata.
At the end of the procedure I would like to reset it, how do I do it?
thanks
Aurora Baccio

JohnMartens

unread,
Jun 24, 2021, 12:32:31 PMJun 24
to
If you are "ready" with your dialog because you have finished in a
method what you want to do just call SELF:EndDialog()

John


Op 24-6-2021 om 15:58 schreef aurora baccio:

aurora baccio

unread,
Jun 24, 2021, 1:12:10 PMJun 24
to
good evening,
I had already tried this solution
here is the answer that I cannot solve
Visual Objects (Version 2.8. Build 3.2838), Version 2.8 SP4b
24-06-2021 19:08:27
Application: c:\Prg28CardioReceipt.DBG

Error message:
--------------
Error Code: 13 [ NO EXPORTED METHOD ].
Subsystem: BASE
Function: SEND
Argument: SEND_MASCHERA:ENDDIALOG
CallStack:
SUBMENUDEMNOW:CELLDOUBLECLICK (Line:17)
MAINWINDOW:LAUNCH (Line:13)
APP:START (Line:441)
START (Line:6)

JohnMartens

unread,
Jun 24, 2021, 3:35:56 PMJun 24
to
And what is the code in CellDoubleClick so we can see
SUBMENUDEMNOW:CELLDOUBLECLICK (Line:17) ?

Op 24-6-2021 om 19:12 schreef aurora baccio:

aurora baccio

unread,
Jun 25, 2021, 8:41:12 AMJun 25
to
AAdd(aParam,self:Owner:Server:CodOperato)
AAdd(aParam,self:Owner:Server:CodFisc)
AAdd(aParam,4) // parte da doppio click
AAdd(aParam,self:Owner:Posiz)

DeleteChildWindow(self:Owner:Caption)
self:Owner:Owner:EndDialog() //Destroy()

oMenuDemNuovo := MenuDemNuovo_Maschera{self:Owner:Owner:Owner,,,aParam}
FabCenterWindow(oMenuDemNuovo)
oMenuDemNuovo:Show()

JohnMartens

unread,
Jun 25, 2021, 10:49:36 AMJun 25
to
I'm not a VO guru like Wolfgang but some remarks

I never use DeleteChildWindow(self:Owner:Caption). I always close/end
the window and let VO clear up the rest

I never close the owner of a window like self:Owner:Owner:EndDialog()
Closing fomr bottom up is what I normaly do. so I use SELF:EndDialog(),
the you get back to the owner which sould close itself and then back to
the owner of the owner

Looks like you want to pull away the tablecloth without removing the
tableware first

John


Op 25-6-2021 om 14:41 schreef aurora baccio:

aurora baccio

unread,
Jun 26, 2021, 2:33:09 AMJun 26
to
good morning Giovanni,
You insist on enddialog, and you are certainly right.
If I write in the double-click method
self:enddialog method, I get a warning at compile time that enddialog is not a method of the submenudemn class.
This means that I have to create an enddialog method
can you give me an example please?
Thank you for your patience.
I searched in help, but this is all I could find

METHOD ButtonClick(oEvent) CLASS MyDialogWindow

IF oEvent:nControlID == ID_OK

SELF:EndDialog(1)

ENDIF

IF oEvent:nControlID == ID_CANCEL

SELF:EndDialog(0)

ENDIF


Aurora Baccio

JohnMartens

unread,
Jun 26, 2021, 2:58:48 AMJun 26
to
Thats easier to solve !!
Probably I understood the wrong type of class you use.

If you type SELf in the code editor and then type the : you will get the
methods that belong to the class. If tou use a data dialog you will find
EndWindow() in the list and not EndDialog

John

Wolfgang Riedmann

unread,
Jun 27, 2021, 1:16:25 AMJun 27
to
Hi Aurora,

unfortunately I was very busy these days.

You cannot trash an object and then access the properties of the
trashed object afterwards.

Wolfgang
--

Wolfgang Riedmann

unread,
Jun 27, 2021, 8:32:05 AMJun 27
to
Hi Aurora,

after thinking again how to explain it better to you, I have two things
to say: (and I will repeat the text below in Italian so you don't need
DeepL to understand)

- first of all: to close a window, don't destroy it, but close it. For
dialogs the correct method is :EndDialog(), for windows :EndWindow().
The destructor method (Destroy() in this case) should only be needed in
rare cases.
- second: as I wrote before (please re-read my message!), if you
destroy an object, you cannot access the properties of it anymore. If
you throw your handbag in the sea, you have no access anymore to the
money in your wallet that is in the handbag. In your case, you are
destroying self:Owner, but you try to access self:Owner:Owner in the
next codeline.

and now the Italian text:
dopo averci pensato come spiegare meglio, ho due cose da dire:
- prima: se deve chiudere und finestra, non distruggerla con Destroy(),
ma chiuderla correttamente. Per i dialog il metodo da chiamare è
EndDialog(), per le Window EndWindow(). Il metodo di distruzione
(Destroy() in questo caso) dovrebbe essere necessario only in casi
veramente rari.
- secondo: come scritto prima (e per favore rilegga il mio messaggio!)
se un oggetto viene distrutto, dopo non si ha più accesso alle
proprietà. Se butta la Sua borsa nel mare, non avrà più accesso ai
soldi che si trovano nel portafoglio nella borsa. Nel Suo caso
distrugge prima self:Owner, e nella prossima riga cerca di accedere a
self:Owner:Owner.

HTH

Wolfgang

P.S. if you are not sure that you understand this, please ask again,
maybe better with a private email in Italian (even if I my nationality
is Italian, my mothers language is German, so my Italian is not
perfect).

And I'm far from being a "VO guru" - I have only a few years of
experience with it, so don't expect too much.
--

aurora baccio

unread,
Jun 30, 2021, 9:00:06 AMJun 30
to
Good morning,
I would like to reply to those who are trying to help me.
I would like to say to Mr Martens that I am a girl, and as such I know that before removing the tablecloth, the cutlery must be removed. I would like to say to Mr Riedman that I also know that you have to look for the money in your wallet, and that there is no point in looking if it is not in your purse. And I immediately make it clear that my reply is not that of an offended or resentful person, on the contrary.
The first line of the code
*DeleteChildWindow(self:Owner:Caption)
is used to delete the caption from the mask control array
*self:Owner:Destroy()
the second deletes the mask.
If I use EndWindow or Destroy the result is the same, EndDialog is not recognized as a VO command.
If I remove the owner, the lines of code are identical in all methods of exiting the mask.
I don't know what's going on, but I'm seriously considering abandoning double-click in this case. Either I'm doing something wrong or the output is wrong.
I apologise for bothering you, and I assure you that I am not offended in the slightest by the examples given.
I thank Mr Riedman for having rewritten the whole thing in Italian, but I would like to point out that I use DeepL only so as not to make any mistakes in writing.
thanks
Aurora Baccio

Wolfgang Riedmann

unread,
Jun 30, 2021, 11:13:32 AMJun 30
to
Hi Aurora,

I'm really sorry that you don't understand what I mean.

Please look again at your original code (and that is why the error
disappeared when commenting the "self:Owner:Destroy()" line):

self:Owner:Destroy()

You are destroying the object that is contained in self:Owner

And then in the next line:

oMenuDemNuovo_Maschera{self:Owner:Owner,,,aParam}

you are accessing the object that is contained in the self:Owner:Owner.

Please remember: you have destroyed self:Owner before, so you cannot
access self:Owner:Owner anymore!!!!

Unfortunately the runtime error caused by this is occurring later, deep
in the GUI classes code, when the GUI classes are using the handle that
is pointing somewhere, but not to a valid window handle.


And it seems you have not understand what John and I both tried to
explain:
if self:Owner is inherited from a DialogWindow, it has a EndDialog
method to close it.
if self:Owner is inherited from a DataWindow or a DataDialog, it has a
EndWindow method to close it.

So, if the VO compiler complains that there is no EndDialog method,
then you have to use the EndWindow method.
Since we don't know not your complete code, it is difficult for us to
understand what kind of object self:Owner is.

Wolfgang

P.S. it seems that you have some talent to misunderstand what we mean

P.P.S. I'm far from undervaluating women in IT: I'm running the company
together with my wife, and she is a very good programmer. Unfortunately
we have much too less women in the IT business....


--

Reply all
Reply to author
Forward
0 new messages