diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2015-06-24 15:41:22 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-06-25 15:55:36 +0000 |
commit | cb840222963f4986a831d5d6f9eb28d1d45083f6 (patch) | |
tree | f2bdb1babecf770ce0564cbab356ff95cd356e9a /ui/qt/main_window.cpp | |
parent | 1810112f2d93d862c8b558279f5537e4db0fa4ad (diff) | |
download | wireshark-cb840222963f4986a831d5d6f9eb28d1d45083f6.tar.gz |
Qt: fix crashes when Wireshark is closed while running a capture
if we haven't captured any packets yet, don't display a warning about
unsaved changes
make sure that we're not running into a scenario where
MainWindow::testCaptureFileClose() tries to close the capture file at
the same time as the pipe handler who sees an eof on the pipe
cf_has_unsaved_data() should return false if we have a temporary file
that contains no packets
Change-Id: I18d75bd658b85d45dd3313d49e2cd654c6300de5
Reviewed-on: https://code.wireshark.org/review/9109
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/main_window.cpp')
-rw-r--r-- | ui/qt/main_window.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 2754714c75..abae150c71 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -1334,7 +1334,7 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) { return true; /* Already closed, nothing to do */ #ifdef HAVE_LIBPCAP - if (capture_file_.capFile()->state == FILE_READ_IN_PROGRESS) { + if (capture_file_.capFile()->state == FILE_READ_IN_PROGRESS && capture_file_.capFile()->count>0) { /* This is true if we're reading a capture file *or* if we're doing a live capture. If we're reading a capture file, the main loop is busy reading packets, and only accepting input from the @@ -1459,6 +1459,7 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) { } else { /* Unchanged file, just close it */ + capture_file_.capFile()->state = FILE_READ_ABORTED; cf_close(capture_file_.capFile()); } } else { |