Ok, thanks a lot guys.
@SMaag:
This is the main structures involved in that function: (the table is at the bottom)
Code: Select all
Structure _XY
x.i
y.i
EndStructure
Structure _Item
text$
text_without_tags$
*callback_submit.__Item
*callback_select.__Item
*callback_color.__Generic
*callback_text.__GenericText
custom_value_submit.i
custom_value_select.i
custom_value_color.i
custom_value_text.i
disabled.b
*page
color.i
background_color.i
align_x.i
no_process.b
underlined.b
List formatted_words._FormattedWord()
EndStructure
Structure _Control
type.i
origin_pos._XY
processed.b
EndStructure
Structure _TableItem Extends _Item
pos._XY
header.b
separator._Separator
no_truncation.b ; If #False, then the part of text$ that is beyond column width will be truncated with a "." character.
EndStructure
Structure _Table Extends _Control
centered.b
unselectable.b
cols.i
rows.i
separator$
vertical_layout.b
*selected_item._TableItem
Array col_sizes.i(0)
Array items._TableItem(0, 0)
items_background_color.i
; List "key browsing" purposes: (see FindNextTableItemFromHotkey())
char_pressed$
char_pressed_time_ms.i
char_pressed_index.i
char_pressed_item_index.i
char_pressed_same.b
EndStructure
So the items() array is defined as: Array items._TableItem(0, 0) that I "Dim" dynamically when needed. And \pos\y is an integer.
The function that crashes returns a pointer to a _TableItem. Here is the full function:
Code: Select all
Procedure.i GetPreviousTableItem(*table._Table) : With *table\selected_item\pos
If *table\selected_item = #Null : DebuggerError("The table has no selected element.") : EndIf
If *table\vertical_layout = #True
If \y > 0
ProcedureReturn *table\items(\x, \y - 1)
ElseIf \x > 0
ProcedureReturn *table\items(\x - 1, ArraySize(*table\items(), 2))
EndIf
Else
If \x > 0
ProcedureReturn *table\items(\x - 1, \y)
ElseIf \y > 0
ProcedureReturn *table\items(ArraySize(*table\items(), 1), \y - 1)
EndIf
EndIf
ProcedureReturn #Null
EndWith : EndProcedure
Please remind me how to get the ASM output? And how to isolate this piece of code particularly?
@#NULL
I think the above answers your first question.
The program crashes exactly at the same line, ie. at "ProcedureReturn pass(......)"
I'm going to try to make a runnable code that imitates the same structure. I don't think it will crash, but hopefully it will...