From f4724d0b37c32d17a4e1d2a7e9db138f0ca9ad2f Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 11 May 2018 12:46:49 -0700 Subject: [PATCH] Qt: MainWindow::dropEvent fixes. Limit our dropped file count to 100. Make sure we always accept our proposed action and either accept or ignore the event. Blind attempt at fixing bug 14609. Change-Id: Id08b179b6eb63529aa15bce7284460fbd19f7fec Ping-Bug: 14609 Reviewed-on: https://code.wireshark.org/review/27462 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- ui/qt/main_window.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 60df683ffc..77a9668f2f 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -989,19 +989,26 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) void MainWindow::dropEvent(QDropEvent *event) { QList local_files; + int max_dropped_files = 100; // Arbitrary foreach (QUrl drop_url, event->mimeData()->urls()) { QString drop_file = drop_url.toLocalFile(); if (!drop_file.isEmpty()) { local_files << drop_file.toUtf8(); + if (local_files.size() >= max_dropped_files) { + break; + } } } - if (local_files.size() < 1) { - return; - } event->acceptProposedAction(); + if (local_files.size() < 1) { + event->ignore(); + return; + } + + event->accept(); if (local_files.size() == 1) { openCaptureFile(local_files.at(0));