From: Konrad Rosenbaum Date: Sun, 10 Jul 2016 09:16:58 +0000 (+0200) Subject: fix double logout X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=9dee383c7875d3cb76053b78fe0b5c1bb42b4ae5;p=web%2Fkonrad%2Fsmoke.git fix double logout --- diff --git a/iface/msinterface.cpp b/iface/msinterface.cpp index ece3e4d..c8d655a 100644 --- a/iface/msinterface.cpp +++ b/iface/msinterface.cpp @@ -95,7 +95,7 @@ MSInterface::MSInterface(QString pid) MSInterface::~MSInterface() { - logout(); + if(autologout)logout(); if(sslexcept)delete sslexcept; sslexcept=0; if(temp)delete temp; @@ -268,6 +268,7 @@ void MSInterface::sslErrors(QNetworkReply *src,const QList&errs) //message box if(!didsslerror){ MBoxWrapper::warning(tr("Connection Error"),tr("There were problems while authenticating the server. Aborting. Check your configuration.")); + didsslerror=true; } } diff --git a/iface/msinterface.h b/iface/msinterface.h index 84c2332..e3fdb72 100644 --- a/iface/msinterface.h +++ b/iface/msinterface.h @@ -104,6 +104,12 @@ class MSIFACE_EXPORT MSInterface:public MInterface ///return the parent directory of the base URL QUrl parentUrl()const; + + ///returns whether this instance automatically logs out on closure + bool autoLogout()const{return autologout;} + + ///sets whether this instance automatically logs out on closure + void setAutoLogout(bool a){autologout=a;} ///return application main data directory static QString appDataDir(); @@ -141,9 +147,9 @@ class MSIFACE_EXPORT MSInterface:public MInterface mutable QListuserrights; mutable QStringList userroles,userflags; QByteArray servertranslation; - MSslExceptions*sslexcept; - bool didsslerror; - MTemplateStore *temp; + MSslExceptions*sslexcept=nullptr; + bool didsslerror=false,autologout=false; + MTemplateStore *temp=nullptr; }; diff --git a/pack b/pack index 3bd32ee..fc4acf0 160000 --- a/pack +++ b/pack @@ -1 +1 @@ -Subproject commit 3bd32ee1471e362af22682c72f562a1bfa761581 +Subproject commit fc4acf0513acbe6413187304fa65ce29b27f9901 diff --git a/sessman/login.cpp b/sessman/login.cpp index 1233c66..617c06c 100644 --- a/sessman/login.cpp +++ b/sessman/login.cpp @@ -121,6 +121,7 @@ void MLogin::startLogin() pd.setVisible(true); //create request object MSInterface *mw=new MSInterface(profiles->itemData(profiles->currentIndex()).toString()); + mw->setAutoLogout(true);//this is the session manager - it handles these things //check server version if(!mw->checkServer()){ //no need for messagebox: checkServer displays one if necessary diff --git a/sessman/sman.cpp b/sessman/sman.cpp index 3c77193..83e37c9 100644 --- a/sessman/sman.cpp +++ b/sessman/sman.cpp @@ -24,6 +24,7 @@ #include "../sesscli/scrand.h" #include +#include MSessionManager::MSessionManager ( QObject* parent ) : QObject ( parent ) { @@ -267,6 +268,7 @@ int main(int ac,char**av) app.setWindowIcon(QIcon(":/icon.png")); MSInterface::setAppDataDir("$BASE/.magicSmoke2"); + WTransaction::setLogPrefix("SM-T"); MBoxWrapper::setWarning([](QString title,QString text){QMessageBox::warning(nullptr,title,text);}); diff --git a/src/main.cpp b/src/main.cpp index db3d7bf..28deac0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,7 @@ #include "msinterface.h" #include "main.h" +#include int MagicSmokeMain::realmain(int argc,char**argv) @@ -31,6 +32,7 @@ int MagicSmokeMain::realmain(int argc,char**argv) sc.connect(&sc,SIGNAL(sessionLost()),&app,SLOT(quit())); sc.connect(&sc,SIGNAL(managerLost()),&app,SLOT(quit())); if(sc.waitForSessionAvailable()){ + WTransaction::setLogPrefix("Main-T"); MSInterface*ms=new MSInterface(sc.currentProfileId()); ms->loginSession(sc.currentUsername(), sc.currentSessionId()); MOverview *mo=new MOverview(sc.currentProfileId()); diff --git a/src/mwin/overview.cpp b/src/mwin/overview.cpp index 23c6632..e4cc47c 100644 --- a/src/mwin/overview.cpp +++ b/src/mwin/overview.cpp @@ -214,8 +214,6 @@ void MOverview::runStartupScript() void MOverview::closeEvent(QCloseEvent*ce) { - //make sure session is deleted - req->logout(); //store geometry QSettings set; set.beginGroup(GEOGROUP);