diff options
author | Sebastien Braun | 2010-10-04 00:25:02 +0200 |
---|---|---|
committer | Sebastien Braun | 2010-10-05 18:15:48 +0200 |
commit | ea719ff8b67916ac0080295bd0698e4ca2a134c8 (patch) | |
tree | f4fb912a587e8366fabe0615940ed7cda60df661 /src/gui | |
parent | Implement first version of basic input event support (diff) | |
download | pvs-ea719ff8b67916ac0080295bd0698e4ca2a134c8.tar.gz pvs-ea719ff8b67916ac0080295bd0698e4ca2a134c8.tar.xz pvs-ea719ff8b67916ac0080295bd0698e4ca2a134c8.zip |
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.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/connectionWindow.h | 3 | ||||
-rw-r--r-- | src/gui/mainWindow.cpp | 23 |
2 files changed, 15 insertions, 11 deletions
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 <iostream> #include <math.h> #include <QSettings> +#include <QPointer> #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<ConnectionFrame> _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); } } |