@Thom_McGrath - yup. See my second post. I think the docs could be clearer here.
Exactly. I think itâs confusing. Probably meant to be convenient? But arguably itâs just misleading.
Bad design on Xojoâs end. Having a timer call that is to be happening later has no use case to cause an error internally (unable to be catched logically). The error should be catched by xojo, Ignored and the call address should be removed as it would be when it was called. Why would anyone use WeakAddressOf if it was to be causing an error (and therefore any closed control to catch you in the back)?
There is no use to have an exception there other than to cause havok. For this NilObjectException. Itâs only useful if xojo had an operator like
Timer.CallLater( 100, Weakaddressof? Somemethod )
To skip if it was nil, some other languages have this â?â
Probably calls into the Session if ther was any. At least that is what the logic should be in my view.
Weâre going down the wrong rabbit hole, I think.
Is there a ticket for the real problem of WebDataSource locking up?
I am using AWS Aurora (MySQL 8 compatible) with MBS SQL plugin, but the data isnât being loaded directly from a RowSet, etc.
The data is pre-fetched into an array of objects which is iterated through to load the data source.
So the classes here are:
- RowDataObject
- ListRowDS (implements WebDataSource)
ListRowDSâ Constructor takes an array of type RowDataObject as its only param.
The method in question (the one being invoked by Timer.CallLater) creates a new instance of ListRowDS and sets the datasource property of the WebListbox:
Private Sub loadApplications(RDArray() as RowDataObject)
select case Session.userRoleID
case Settings.roleAdmin
self.projects_list.RowSelectionType = WebListBox.RowSelectionTypes.Multiple
end select
If RDArray.LastIndex >= 0 Then
dim ds as new ListRowDS(RDArray)
self.ProjectList.Datasource = ds
else
self.ProjectList.DataSource = Nil
self.ProjectList.RemoveAllRows
self.ProjectList.NoRowsMessage = "No Data Found"
end if
Return
End Sub
thatâs it.
I think this only happens to Admin users (theyâre the only ones who have reported it) and looking at the code, theyâre the only users where RowSelectionTypes.Multiple is set.
Do your WebListBoxes allow selecting multiple rows.
That being said, introducing just a little delay has made this problem go away for them. so�??
Back to the original topic for a sec, what you could do instead is use a messaging queue and have callLater call that. The messaging queue would hold the weak addresses and could then check if the target was nil before calling it.
@Greg_O - Appreciate the thought.
I do similar for other functions in the app and may go that route.
The ârealâ original issue was the WebListbox âmisbehavingâ when being used with a data source; itâs what prompted my use (aka abuse
) of WebTimer.CallLater in the first place.
For now, Iâve added some extra data points and logging (as this hasnât happened in the last two days) to see if I can âcatch the exception in the actâ.
What Iâd like is for the WebListBox to never get âhungâ showing the processing message until you refresh the list either by fixing an error on my part or helping discover and fix a bug in the Web Framework.
â
EDIT - Apparently I forgot the topic of my own thread (
). I do consider this âsolvedâ by Thom as I was just misunderstanding what WebTimer.CallLater does.
Anthony
About Timer vs WebTimer. Timer.CallLater isnât session aware, while WebTimer.CallLater is.
The idea is to be able to modify things without having to store the session identifier somewhere and having to restore the session context before modifying a WebLabel, for example, that lives inside a session.
Here is a sample project. Timer.CallLater wonât work, WebTimer.CallLater will be able to update the label without additional work:
CallLater.xojo_binary_project.zip (8.9 KB)