Hide PyOtherSide error when EventList is destroyed

This commit is contained in:
miruka 2019-08-19 13:14:25 -04:00
parent 5e5a658173
commit 98803e8c23

View File

@ -72,11 +72,25 @@ HRectangle {
onYPosChanged: if (canLoad && yPos < 0.1) Qt.callLater(loadPastEvents) onYPosChanged: if (canLoad && yPos < 0.1) Qt.callLater(loadPastEvents)
function loadPastEvents() { function loadPastEvents() {
// try/catch blocks to hide pyotherside error when the
// component is destroyed but func is still running
try {
eventList.canLoad = false eventList.canLoad = false
py.callClientCoro( py.callClientCoro(
chatPage.userId, "load_past_events", [chatPage.roomId], chatPage.userId, "load_past_events", [chatPage.roomId],
moreToLoad => { eventList.canLoad = moreToLoad } moreToLoad => {
try {
eventList.canLoad = moreToLoad
} catch (err) {
return
}
}
) )
} catch (err) {
return
}
} }
property string inviter: chatPage.roomInfo.inviter || "" property string inviter: chatPage.roomInfo.inviter || ""