I have this problem before, and had solved it with kickaha's help by simply Re-Dimming arrays/types before assigning them somewhere.
Here I am having trouble again and Re-dimming doesnt help:
Narrowed it down to this function:
TaskItems is a custom type array in Process Globals of a service.
where dpservice is a service.
Anyways, the relevant logs before and after running this code are:
Yet, I have tried re-initialising and redimming the array but nothing works.
Any ideas??
EDIT:
Actually the problem is in a loop in the service:
I thought the Variable TempTI should take care of de-linking the reference. But apparantly not.
Still havent fixed it though.
Here I am having trouble again and Re-dimming doesnt help:
Narrowed it down to this function:
TaskItems is a custom type array in Process Globals of a service.
B4X:
Dim TaskItems(20) As TaskItemType
B4X:
Sub CreateTask(TaskType As Int, ScheduledTime As Long,Pipe As String, SourcePath As String, DestPath As String, Filter As String)
Log("DB Created Task: Que" & dpservice.TotalQueItems & " Dest:" & SourcePath)
'Re-Dim
' List all tasks
Log("Before Create: List of all tasks: (Items:" & dpservice.TotalQueItems & ")")
Log("==================")
For i = 0 To dpservice.TotalQueItems -1
Log(dpservice.TaskItems(i).QueIndex & " " & dpservice.TaskItems(i).SourcePath)
Next
Log("===================")
dpservice.TaskItems(dpservice.TotalQueItems).Initialize
dpservice.TaskItems(dpservice.TotalQueItems).TaskType = TaskType
dpservice.TaskItems(dpservice.TotalQueItems).Pipe = Pipe
dpservice.TaskItems(dpservice.TotalQueItems).ScheduledTime = ScheduledTime
dpservice.TaskItems(dpservice.TotalQueItems).SourcePath = sourcepath
dpservice.TaskItems(dpservice.TotalQueItems).DestPath = DestPath
dpservice.TaskItems(dpservice.TotalQueItems).TaskCommand = filter
dpservice.TaskItems(dpservice.TotalQueItems).Processing = False
dpservice.TaskItems(dpservice.TotalQueItems).Qued = True
dpservice.TaskItems(dpservice.TotalQueItems).QueIndex = dpservice.TotalQueItems
dpservice.TotalQueItems = dpservice.TotalQueItems + 1
' Start service at ScheduledTime
'!!! Do not create if Pipe/task already exists
' List all tasks
Log("After Create: List of all tasks: (Items:" & dpservice.TotalQueItems & ")")
Log("==================")
For i = 0 To dpservice.TotalQueItems -1
Log(dpservice.TaskItems(i).QueIndex & " " & dpservice.TaskItems(i).SourcePath)
Next
Log("===================")
StartServiceAt("dpservice",ScheduledTime,False)
End Sub
where dpservice is a service.
Anyways, the relevant logs before and after running this code are:
B4X:
Before Create: List of all tasks: (Items:1)
==================
0 https://api.dropbox.com/0/metadata/dropbox/Public?
===================
After Create: List of all tasks: (Items:2)
==================
1 https://api.dropbox.com/0/metadata/dropbox/Photos/Sample%20Album?
1 https://api.dropbox.com/0/metadata/dropbox/Photos/Sample%20Album?
===================
Yet, I have tried re-initialising and redimming the array but nothing works.
Any ideas??
EDIT:
Actually the problem is in a loop in the service:
B4X:
For i = 0 To TotalQueItems - 2
Dim TempTI As TaskItemType
TempTI.Initialize
TempTI = TaskItems(i + 1)
TaskItems(i) = TempTI
TaskItems(i).QueIndex = TaskItems(i).QueIndex - 1
Next
Still havent fixed it though.
Last edited: