Fix rare and strange crash in modern UI

This commit is contained in:
Abs62 2014-04-25 20:43:01 +04:00
parent 5144baa05c
commit 246fa6c1fa
2 changed files with 22 additions and 0 deletions

View file

@ -137,3 +137,20 @@ void WordList::refreshTranslateLine()
}
}
void WordList::resizeEvent( QResizeEvent * ev )
{
// In some rare cases Qt start send QResizeEvent recursively
// up to full stack depletion (tested on Qt 4.8.5, 4.8.6).
// We use this trick to break such suicidal process.
for( int x = 0; x < resizedSizes.size(); x++ )
if( resizedSizes.at( x ) == ev->size() )
return;
resizedSizes.push_back( ev->size() );
QListWidget::resizeEvent( ev );
resizedSizes.pop_back();
}

View file

@ -19,6 +19,9 @@ public:
virtual void setTranslateLine(QLineEdit * line)
{ translateLine = line; }
protected:
virtual void resizeEvent( QResizeEvent * ev );
signals:
void statusBarMessage(QString const & message, int timeout = 0, QPixmap const & pixmap = QPixmap());
void contentChanged();
@ -36,6 +39,8 @@ private:
WordFinder * wordFinder;
QLineEdit * translateLine;
WordListItemDelegate listItemDelegate;
QVector< QSize > resizedSizes;
};
#endif // WORDLIST_HH