Project

General

Profile

Destructor Sometimes Not Firing On Refresh

Added by Gavin Limchayseng over 1 year ago

Hey Guys,

First time posting here but I've been working with Wt for a bit now and I'm wondering if the inconsistency of the WtApplication destructor not firing on refreshes has been fixed? I don't know if any of you have run into this but occasionally when you refresh the page it will not call the destructor which isn't the biggest deal if you don't have anything to destroy but in my case, I need to make sure a thread is closing. I have a socket connection active on that thread and if it isn't closed down properly it'll hold that connection and the new webpage wont have the info going over the socket. I just want to know if there is a better solution for things in the destuctor.

Thanks,
Gav


Replies (2)

RE: Destructor Sometimes Not Firing On Refresh - Added by Roel Standaert over 1 year ago

The destructor being run relies on the client-side JavaScript sending a request to the server notifying that the tab is being closed. There is no guarantee that this request actually comes through or is sent at all.

The destructor will then eventually run when the session times out.

I suppose maybe there are things we could do for refreshes specifically...

RE: Destructor Sometimes Not Firing On Refresh - Added by Roel Standaert over 1 year ago

I added an issue to mark it as something we could revisit in the future: https://redmine.webtoolkit.eu/issues/11018

    (1-2/2)