#209656 - 2014-11-18 12:45 PM
"Stack overflow exception" bug in 4.64 not in 4.53
|
BillBarnard
Starting to like KiXtart
Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
|
I am receiving the following error in Kix32 version 4.64:- Stack overflow exception. The common cause for this type of exception is an endless recursive loop. Please check your script(s) for endless loops. If I run my program with kix32 version 4.53 my program works. Basically, I am using a recursive function to fill a graphic area.
Function FillBill($x, $y, $f, $r)
; If pixel colour at ($x,$y) is $f replace it with colour $r
If $form.point($x, $y) = $f
Dim $c
$c = $form.forecolor ; Save Forecolor
$Form.forecolor = $r
$form.pset($x, $y)
FillBill($x+1, $y, $f, $r)
FillBill($x-1, $y, $f, $r)
FillBill($x, $y+1, $f, $r)
FillBill($x, $y-1, $f, $r)
$form.forecolor = $c ; Restore Forecolor
Endif
What is different with the latest version of kix32.exe from previous versions as regards to memory usage? Please ignore the fact that the actual coding above does not fill in pixels in the 4 corner positions around the target pixel. It's only a test script. I'm also using Kixforms 2.47.5. Regards,
_________________________
Bill
|
Top
|
|
|
|
#209658 - 2014-11-18 05:10 PM
Re: "Stack overflow exception" bug in 4.64 not in 4.53
[Re: BillBarnard]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
uh oh... function calling itself sounds like infinite loop waiting to happen...
have you tried outputting something on the console to see how many times it is ran?
say, add a global var $test_runs = 0 at the start of your script and modify your fillbill to:
Function FillBill($x, $y, $f, $r)
; If pixel colour at ($x,$y) is $f replace it with colour $r
If $form.point($x, $y) = $f
$test_runs=$test_runs+1 chr(13) $test_runs
Dim $c
$c = $form.forecolor ; Save Forecolor
$Form.forecolor = $r
$form.pset($x, $y)
FillBill($x+1, $y, $f, $r)
FillBill($x-1, $y, $f, $r)
FillBill($x, $y+1, $f, $r)
FillBill($x, $y-1, $f, $r)
$form.forecolor = $c ; Restore Forecolor
Endif
what is the number at when it crashes?
_________________________
!download KiXnet
|
Top
|
|
|
|
Moderator: ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 370 anonymous users online.
|
|
|