Qt: Do not use exec() in RTP dialogs

Favor asynchronous show() as it does not create new event loop.

Change-Id: I01982806f87705f04138f15ae8eb084f1d4f9b2c
Reviewed-on: https://code.wireshark.org/review/34677
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Tomasz Moń 2019-10-02 16:29:35 +02:00 committed by Anders Broman
parent 4108b54bc1
commit a83ee43846
3 changed files with 16 additions and 11 deletions

View File

@ -1004,7 +1004,7 @@ void RtpAnalysisDialog::showPlayer()
#ifdef QT_MULTIMEDIA_LIB
if (num_streams_ < 1) return;
RtpPlayerDialog rtp_player_dialog(*this, cap_file_);
RtpPlayerDialog *rtp_player_dialog = new RtpPlayerDialog(*this, cap_file_);
rtpstream_info_t stream_info;
// XXX We might want to create an "rtp_stream_id_t" struct with only
@ -1014,7 +1014,7 @@ void RtpAnalysisDialog::showPlayer()
stream_info.packet_count = fwd_statinfo_.packet_count;
stream_info.setup_frame_number = fwd_statinfo_.setup_frame_number;
nstime_copy(&stream_info.start_rel_time, &fwd_statinfo_.start_rel_time);
rtp_player_dialog.addRtpStream(&stream_info);
rtp_player_dialog->addRtpStream(&stream_info);
if (num_streams_ > 1) {
rtpstream_info_init(&stream_info);
@ -1022,12 +1022,14 @@ void RtpAnalysisDialog::showPlayer()
stream_info.packet_count = rev_statinfo_.packet_count;
stream_info.setup_frame_number = rev_statinfo_.setup_frame_number;
nstime_copy(&stream_info.start_rel_time, &rev_statinfo_.start_rel_time);
rtp_player_dialog.addRtpStream(&stream_info);
rtp_player_dialog->addRtpStream(&stream_info);
}
connect(&rtp_player_dialog, SIGNAL(goToPacket(int)), this, SIGNAL(goToPacket(int)));
connect(rtp_player_dialog, SIGNAL(goToPacket(int)), this, SIGNAL(goToPacket(int)));
rtp_player_dialog.exec();
rtp_player_dialog->setWindowModality(Qt::ApplicationModal);
rtp_player_dialog->setAttribute(Qt::WA_DeleteOnClose);
rtp_player_dialog->show();
#endif // QT_MULTIMEDIA_LIB
}
@ -1538,7 +1540,7 @@ void RtpAnalysisDialog::graphClicked(QMouseEvent *event)
{
updateWidgets();
if (event->button() == Qt::RightButton) {
graph_ctx_menu_.exec(event->globalPos());
graph_ctx_menu_.popup(event->globalPos());
}
}

View File

@ -56,7 +56,7 @@ public:
void reject();
/** Add an RTP stream to play.
* MUST be called before exec().
* MUST be called before show().
* Requires src_addr, src_port, dest_addr, dest_port, ssrc, packet_count,
* setup_frame_number, and start_rel_time.
*

View File

@ -390,13 +390,14 @@ void VoipCallsDialog::showSequence()
}
SequenceDialog *sequence_dialog = new SequenceDialog(parent_, cap_file_, sequence_info_);
sequence_dialog->setAttribute(Qt::WA_DeleteOnClose);
sequence_dialog->show();
}
void VoipCallsDialog::showPlayer()
{
#ifdef QT_MULTIMEDIA_LIB
RtpPlayerDialog rtp_player_dialog(*this, cap_file_);
RtpPlayerDialog *rtp_player_dialog = new RtpPlayerDialog(*this, cap_file_);
foreach (QModelIndex index, ui->callTreeView->selectionModel()->selectedIndexes()) {
voip_calls_info_t *vci = VoipCallsInfoModel::indexToCallInfo(index);
@ -411,14 +412,16 @@ void VoipCallsDialog::showPlayer()
// rsi->call_num, rsi->start_fd->num, rsi->setup_frame_number);
if (vci->call_num == static_cast<guint>(rsi->call_num)) {
//VOIP_CALLS_DEBUG("adding call number %u", vci->call_num);
rtp_player_dialog.addRtpStream(rsi);
rtp_player_dialog->addRtpStream(rsi);
}
}
}
connect(&rtp_player_dialog, SIGNAL(goToPacket(int)), this, SIGNAL(goToPacket(int)));
connect(rtp_player_dialog, SIGNAL(goToPacket(int)), this, SIGNAL(goToPacket(int)));
rtp_player_dialog.exec();
rtp_player_dialog->setWindowModality(Qt::ApplicationModal);
rtp_player_dialog->setAttribute(Qt::WA_DeleteOnClose);
rtp_player_dialog->show();
#endif // QT_MULTIMEDIA_LIB
}