mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Ensured that inserConnect() is only called when the widget is visible
- added new method RsautoUpdatePage::securedUpdatePage() - made insertConnect() private to disallow connecting it with callbacks in notifyQt.cpp - this should also correct some possible deadlocks in passphrase handling Needs full recompile + qmake of GUI git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6373 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
469b37aa60
commit
bb916ad1cc
@ -184,7 +184,7 @@ void NetworkDialog::changeEvent(QEvent *e)
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::StyleChange:
|
||||
insertConnect();
|
||||
securedUpdateDisplay();
|
||||
break;
|
||||
default:
|
||||
// remove compiler warnings
|
||||
@ -192,13 +192,6 @@ void NetworkDialog::changeEvent(QEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
//void NetworkDialog::updateNewDiscoveryInfo()
|
||||
//{
|
||||
// //std::cerr << "Received new p3disc info. Updating networkview." << std::endl;
|
||||
// //networkview->update();
|
||||
// //networkview->updateDisplay();
|
||||
//}
|
||||
|
||||
void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
//std::cerr << "NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint point ) called" << std::endl;
|
||||
@ -263,7 +256,7 @@ void NetworkDialog::denyFriend()
|
||||
std::string peer_id = wi->text(COLUMN_PEERID).toStdString() ;
|
||||
rsPeers->removeFriend(peer_id) ;
|
||||
|
||||
insertConnect() ;
|
||||
securedUpdateDisplay();
|
||||
}
|
||||
void NetworkDialog::deleteCert()
|
||||
{
|
||||
@ -276,7 +269,7 @@ void NetworkDialog::deleteCert()
|
||||
std::string peer_id = wi->text(9).toStdString() ;
|
||||
rsPeers->deleteCertificate(peer_id) ;
|
||||
|
||||
insertConnect() ;
|
||||
securedUpdateDisplay();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
void setBackgroundColorHasSignedMe(QColor color) { mBackgroundColorHasSignedMe = color; }
|
||||
void setBackgroundColorDenied(QColor color) { mBackgroundColorDenied = color; }
|
||||
|
||||
public slots:
|
||||
private:
|
||||
void insertConnect();
|
||||
// std::string loadneighbour();
|
||||
/* void loadneighbour(); */
|
||||
|
@ -23,6 +23,14 @@ RsAutoUpdatePage::~RsAutoUpdatePage()
|
||||
_timer = NULL ;
|
||||
}
|
||||
|
||||
void RsAutoUpdatePage::securedUpdateDisplay()
|
||||
{
|
||||
if(_locked == false && isVisible()) {
|
||||
updateDisplay();
|
||||
update() ; // Qt flush
|
||||
}
|
||||
}
|
||||
|
||||
void RsAutoUpdatePage::showEvent(QShowEvent */*event*/)
|
||||
{
|
||||
//std::cout << "RsAutoUpdatePage::showEvent() In show event !!" << std::endl ;
|
||||
@ -34,14 +42,11 @@ void RsAutoUpdatePage::timerUpdate()
|
||||
{
|
||||
// only update when the widget is visible.
|
||||
//
|
||||
if(_locked == false && isVisible()) {
|
||||
updateDisplay();
|
||||
update() ; // Qt flush
|
||||
}
|
||||
|
||||
securedUpdateDisplay() ;
|
||||
_timer->start() ;
|
||||
}
|
||||
|
||||
void RsAutoUpdatePage::lockAllEvents() { _locked = true ; }
|
||||
void RsAutoUpdatePage::unlockAllEvents() { _locked = false ; }
|
||||
bool RsAutoUpdatePage::eventsLocked() { return _locked ; }
|
||||
|
||||
|
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
|
||||
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool) )) ;
|
||||
QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
|
||||
QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) ));
|
||||
QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(insertConnect() )) ;
|
||||
QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(securedUpdateDisplay())) ;
|
||||
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;
|
||||
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
|
||||
|
||||
|
@ -21,13 +21,23 @@ class RsAutoUpdatePage: public MainPage
|
||||
RsAutoUpdatePage(int ms_update_period = 1000, QWidget *parent = NULL, Qt::WindowFlags flags = 0) ;
|
||||
virtual ~RsAutoUpdatePage() ;
|
||||
|
||||
virtual void updateDisplay() {}
|
||||
|
||||
static void lockAllEvents() ;
|
||||
static void unlockAllEvents() ;
|
||||
static bool eventsLocked() ;
|
||||
|
||||
public slots:
|
||||
// This method updates the widget only if not locked, and if visible.
|
||||
// This is *the* method to call when on callbacks etc, to avoid locks due
|
||||
// to Qt calling itself through recursive behavior such as passphrase
|
||||
// handling etc.
|
||||
//
|
||||
void securedUpdateDisplay() ;
|
||||
|
||||
protected:
|
||||
// This is overloaded in subclasses.
|
||||
//
|
||||
virtual void updateDisplay() {}
|
||||
|
||||
virtual void showEvent(QShowEvent *e) ;
|
||||
|
||||
private slots:
|
||||
|
Loading…
Reference in New Issue
Block a user