From ea719ff8b67916ac0080295bd0698e4ca2a134c8 Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Mon, 4 Oct 2010 00:25:02 +0200 Subject: Fix a bug in closeup frame handling. If, while a frame was in closeup mode, the corresponding client went away, the ConnectionFrame would get deleted, but still referenced in ConnectionWindow::_closeupFrame. Naturally, this led to disaster when the same (but really new) frame would be selected again. QPointer guards against QObject's going AWOL. --- src/gui/connectionWindow.h | 3 ++- src/gui/mainWindow.cpp | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'src/gui') diff --git a/src/gui/connectionWindow.h b/src/gui/connectionWindow.h index 81b5033..85e2881 100644 --- a/src/gui/connectionWindow.h +++ b/src/gui/connectionWindow.h @@ -9,6 +9,7 @@ #include #include #include +#include #define FRAME_DELAY 1000 // to comply with the standard value in the gui @@ -109,7 +110,7 @@ protected: private: ConnectionFrame* newConFrame(PVSClient* newConnection); // returns a new frame for the given connection ConnectionFrame* currentSingleFrame; // pointer to the frame thats currently in FullScreen - ConnectionFrame* _closeupFrame; + QPointer _closeupFrame; QPoint currentPosition (ConnectionFrame* cF); QMenu *menu; QAction *newDummy; diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index eb15e82..8a2b512 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -742,19 +742,22 @@ void MainWindow::closeUp() QMessageBox::information(this, "PVS", message); } } - else if (conWin->getCloseupFrame()) + else { - /*PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selectedClients->front().toStdString().c_str());*/ - conWin->getCloseupFrame()->setWindowFlags(Qt::Widget); - conWin->getCloseupFrame()->paintCloseUp(conWin->getCloseupFrame()->getPrevWidth(), conWin->getCloseupFrame()->getPrevHeight()); - conWin->getCloseupFrame()->move(_framePosOnCloseUp);//back to the position before the closeup - if (conWin->getCloseupFrame()->getConnection()->getVNCConnection()) - conWin->getCloseupFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(_updatefreq); + if (conWin->getCloseupFrame()) + { + /*PVSClient* pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + selectedClients->front().toStdString().c_str());*/ + conWin->getCloseupFrame()->setWindowFlags(Qt::Widget); + conWin->getCloseupFrame()->paintCloseUp(conWin->getCloseupFrame()->getPrevWidth(), conWin->getCloseupFrame()->getPrevHeight()); + conWin->getCloseupFrame()->move(_framePosOnCloseUp);//back to the position before the closeup + if (conWin->getCloseupFrame()->getConnection()->getVNCConnection()) + conWin->getCloseupFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(_updatefreq); + conWin->setCloseupFrame(NULL); + } is_closeup = false; - conWin->setCloseupFrame(NULL); } } -- cgit v1.2.3-55-g7522