diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-05-13 11:13:07 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-05-13 20:07:42 +0000 |
commit | 43776d4b7391874a69a706661a71f2020c05230b (patch) | |
tree | 81aee5992b07bfb2d5423c791f25f11eece1570c /ui | |
parent | 4ec84a3e2b1023bb6d27fc4fdb3d69cd2385f2e2 (diff) | |
download | wireshark-43776d4b7391874a69a706661a71f2020c05230b.tar.gz |
Qt: Fix a recent files infinite loop.
QListWidget::takeItem does nothing if the row is invalid. This is the
case when we pass it ::count(). Make sure that we remove a valid row and
that our loop will terminate.
Follow-up to g174dc98.
Change-Id: I7e695cc04b2f3b5c28a8cc70af0579d787ff8737
Reviewed-on: https://code.wireshark.org/review/15417
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/main_welcome.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp index b5cb3dc878..61623def82 100644 --- a/ui/qt/main_welcome.cpp +++ b/ui/qt/main_welcome.cpp @@ -384,8 +384,10 @@ void MainWelcome::updateRecentFiles() { rfRow++; } - while ((unsigned)recent_files_->count() > prefs.gui_recent_files_count_max) { - recent_files_->takeItem(recent_files_->count()); + int row = recent_files_->count(); + while (row > 0 && row > (int) prefs.gui_recent_files_count_max) { + row--; + recent_files_->takeItem(row); } if (recent_files_->count() > 0) { welcome_ui_->openFrame->animatedShow(); |