qt: follow stream: fix crash during close
The Follow Stream dialogue's button "Filter out this stream" filters out the stream's packets and then closes the Follow Stream dialogue. This may take a moment. If the user presses the Close button while the filtering is still running, the dialogue will be closed twice. This causes a crash which can be seen in ASAN builds. ==9485==ERROR: AddressSanitizer: SEGV on unknown address 0x60205e80001b (pc 0x7f923e672b8c sp 0x7fff73104600 bp 0x7fff73104600 T0) #0 0x7f923e672b8b in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2d9b8b) #1 0x7f924f46010b in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x13f10b) #2 0x7f924f4655ff in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1445ff) #3 0x7f923e672dca in QCoreApplication::notifyInternal(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2d9dca) #4 0x7f924f49ae54 in QWidgetPrivate::close_helper(QWidgetPrivate::CloseMode) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x179e54) #5 0x55f3e249582f in FollowStreamDialog::close() /media/sf_wireshark.git/ui/qt/follow_stream_dialog.cpp:327 #6 0x55f3e236e534 in FollowStreamDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ui/qt/moc_follow_stream_dialog.cpp:155 ... SUMMARY: AddressSanitizer: SEGV ??:0 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ==9485==ABORTING Ignore the Close button if we know that we'll be closing the dialogue shortly. Change-Id: Ibf1684fd75937e6b24fcb9ea62ae6acb038260e6 Reviewed-on: https://code.wireshark.org/review/24777 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
5aa50639ac
commit
621498f88e
|
@ -83,7 +83,8 @@ FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_
|
||||||
last_from_server_(0),
|
last_from_server_(0),
|
||||||
turns_(0),
|
turns_(0),
|
||||||
save_as_(false),
|
save_as_(false),
|
||||||
use_regex_find_(false)
|
use_regex_find_(false),
|
||||||
|
terminating_(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
loadGeometry(parent.width() * 2 / 3, parent.height());
|
loadGeometry(parent.width() * 2 / 3, parent.height());
|
||||||
|
@ -318,6 +319,8 @@ void FollowStreamDialog::filterOut()
|
||||||
|
|
||||||
void FollowStreamDialog::close()
|
void FollowStreamDialog::close()
|
||||||
{
|
{
|
||||||
|
terminating_ = true;
|
||||||
|
|
||||||
// Update filter - Use:
|
// Update filter - Use:
|
||||||
// previous_filter if 'Close' (passed in follow() method)
|
// previous_filter if 'Close' (passed in follow() method)
|
||||||
// filter_out_filter_ if 'Filter Out This Stream' (built by appending !current_stream to previous_filter)
|
// filter_out_filter_ if 'Filter Out This Stream' (built by appending !current_stream to previous_filter)
|
||||||
|
@ -373,9 +376,12 @@ void FollowStreamDialog::on_streamNumberSpinBox_valueChanged(int stream_num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not sure why we have to do this manually.
|
|
||||||
void FollowStreamDialog::on_buttonBox_rejected()
|
void FollowStreamDialog::on_buttonBox_rejected()
|
||||||
{
|
{
|
||||||
|
// Ignore the close button if FollowStreamDialog::close() is running.
|
||||||
|
if (terminating_)
|
||||||
|
return;
|
||||||
|
|
||||||
WiresharkDialog::reject();
|
WiresharkDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,8 @@ private:
|
||||||
bool save_as_;
|
bool save_as_;
|
||||||
bool use_regex_find_;
|
bool use_regex_find_;
|
||||||
QFile file_;
|
QFile file_;
|
||||||
|
|
||||||
|
bool terminating_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FOLLOW_STREAM_DIALOG_H
|
#endif // FOLLOW_STREAM_DIALOG_H
|
||||||
|
|
Loading…
Reference in New Issue