Page MenuHome GnuPG

Fix server crash on web client disconnect
ClosedPublic

Authored by tfry on Thu, Dec 11, 8:57 AM.

Details

Reviewers
svuorela
Summary

When a web client disconnects, the associated QWebSocket object is deleted via WebServer::socketDisconnected. So far this happens by immediately calling the destructor (as we release the unique_ptr from the m_clients list).

However, the QWebSocket may still be needed in the Qt event loop at this time, so the event loop will crash on the next iteration. We have to call QObject::deleteLater(), instead.

Since the *only* purpose of WebServer::m_clients is to manage the lifetime of QWebSocket instances, we can also rewrite this in a more concise an readable way.

Test Plan

Tested by logging onto outlook without having the approriate key in the keyring. This causes an error message, and a client disconnect.

Diff Detail

Repository
rOJ GpgOL.js
Lint
Lint Skipped
Unit
Unit Tests Skipped