Skip to content
Snippets Groups Projects
Commit 8d84dbe5 authored by Sergey Linev's avatar Sergey Linev Committed by Bertrand Bellenot
Browse files

webgui: terminate application via timeout

Otherwise it could happen, that calling object (websocket handler) will
be destroyed by such action. 

Like now civetweb is blocked, waiting that websoocket request is
processed, but gApplication->Terminate() starts deleting of all
connections and trying to call mg_stop.
parent e7331074
No related branches found
No related tags found
No related merge requests found
......@@ -569,7 +569,7 @@ void ROOT::Experimental::TCanvasPainter::ProcessData(unsigned connid, const std:
conn->fGetMenu = cdata;
} else if (arg == "QUIT") {
// use window manager to correctly terminate http server
TWebWindowsManager::Instance()->Terminate(0);
TWebWindowsManager::Instance()->Terminate();
return;
} else if (arg == "RELOAD") {
conn->fSend = 0; // reset send version, causes new data sending
......
......@@ -66,7 +66,7 @@ public:
int WaitFor(WebWindowWaitFunc_t check, double tm);
/// Terminate http server and ROOT application
void Terminate(int code = 0);
void Terminate();
};
......
......@@ -31,6 +31,7 @@
#include "TString.h"
#include "TStopwatch.h"
#include "TApplication.h"
#include "TTimer.h"
/** \class ROOT::Experimental::TWebWindowManager
\ingroup webdisplay
......@@ -323,11 +324,12 @@ int ROOT::Experimental::TWebWindowsManager::WaitFor(WebWindowWaitFunc_t check, d
//////////////////////////////////////////////////////////////////////////
/// Terminate http server and ROOT application
void ROOT::Experimental::TWebWindowsManager::Terminate(int code)
void ROOT::Experimental::TWebWindowsManager::Terminate()
{
if (fServer)
fServer->SetTerminate();
// use timer to avoid situation when calling object is deleted by terminate
if (gApplication)
gApplication->Terminate(code);
TTimer::SingleShot(100, "TApplication", gApplication, "Terminate()");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment