From 6cd1b3bb194ffe7896a549bdbdee111c698744f8 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 29 May 2020 10:24:24 -0400 Subject: [PATCH] 2020-05-29 Fred Gleason * Fixed a bug in rdairplay(1) where attempting to audition an audio cart with a disabled cue output would crash the application. Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ lib/rdcueedit.cpp | 26 +++++++++++++------------- lib/rdcueedit.h | 7 ++----- lib/rdcueeditdialog.cpp | 4 ++-- rdairplay/button_log.cpp | 9 ++++----- rdairplay/button_log.h | 7 +++---- rdairplay/edit_event.cpp | 8 +++----- rdairplay/edit_event.h | 5 ++--- rdairplay/list_log.cpp | 5 ++--- rdairplay/list_log.h | 5 ++--- rdairplay/rdairplay.cpp | 6 +++--- 11 files changed, 39 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index f40bd487..33da0ad7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19850,3 +19850,6 @@ 2020-05-23 Fred Gleason * Fixed a bug in 'RDFormPost' that caused an error when processing multipart-mime submissions containing '=' characters. +2020-05-29 Fred Gleason + * Fixed a bug in rdairplay(1) where attempting to audition an + audio cart with a disabled cue output would crash the application. diff --git a/lib/rdcueedit.cpp b/lib/rdcueedit.cpp index d5a17c80..4b04b82f 100644 --- a/lib/rdcueedit.cpp +++ b/lib/rdcueedit.cpp @@ -2,7 +2,7 @@ // // Cueing Editor for RDLogLine-based Events // -// (C) Copyright 2013-2019 Fred Gleason +// (C) Copyright 2013-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -26,12 +26,9 @@ #include "rdconf.h" #include "rdcueedit.h" -RDCueEdit::RDCueEdit(RDCae *cae,int card,int port,QWidget *parent) +RDCueEdit::RDCueEdit(QWidget *parent) : RDWidget(parent) { - edit_cae=cae; - edit_play_card=card; - edit_play_port=port; edit_height=325; edit_slider_pressed=false; edit_shift_pressed=false; @@ -102,7 +99,8 @@ RDCueEdit::RDCueEdit(RDCae *cae,int card,int port,QWidget *parent) edit_audition_button-> setPalette(QPalette(backgroundColor(),QColor(Qt::gray))); edit_audition_button->setFont(buttonFont()); - // edit_audition_button->setText(tr("&Audition")); + edit_audition_button-> + setDisabled((rda->station()->cueCard()<0)||(rda->station()->cuePort()<0)); connect(edit_audition_button,SIGNAL(clicked()), this,SLOT(auditionButtonData())); @@ -114,7 +112,8 @@ RDCueEdit::RDCueEdit(RDCae *cae,int card,int port,QWidget *parent) edit_pause_button-> setPalette(QPalette(backgroundColor(),QColor(Qt::gray))); edit_pause_button->setFont(buttonFont()); - // edit_pause_button->setText(tr("&Pause")); + edit_pause_button-> + setDisabled((rda->station()->cueCard()<0)||(rda->station()->cuePort()<0)); connect(edit_pause_button,SIGNAL(clicked()),this,SLOT(pauseButtonData())); // @@ -126,7 +125,8 @@ RDCueEdit::RDCueEdit(RDCae *cae,int card,int port,QWidget *parent) edit_stop_button-> setPalette(QPalette(backgroundColor(),QColor(Qt::gray))); edit_stop_button->setFont(buttonFont()); - // edit_stop_button->setText(tr("&Stop")); + edit_stop_button-> + setDisabled((rda->station()->cueCard()<0)||(rda->station()->cuePort()<0)); connect(edit_stop_button,SIGNAL(clicked()),this,SLOT(stopButtonData())); // @@ -180,7 +180,7 @@ RDCueEdit::RDCueEdit(RDCae *cae,int card,int port,QWidget *parent) // // Play Deck // - edit_play_deck=new RDPlayDeck(edit_cae,RDPLAYDECK_AUDITION_ID,this); + edit_play_deck=new RDPlayDeck(rda->cae(),RDPLAYDECK_AUDITION_ID,this); connect(edit_play_deck,SIGNAL(stateChanged(int,RDPlayDeck::State)),this, SLOT(stateChangedData(int,RDPlayDeck::State))); connect(edit_play_deck,SIGNAL(position(int,int)), @@ -312,8 +312,8 @@ void RDCueEdit::auditionButtonData() if(edit_play_deck->state()==RDPlayDeck::Playing) { return; } - edit_play_deck->setCard(edit_play_card); - edit_play_deck->setPort(edit_play_port); + edit_play_deck->setCard(rda->station()->cueCard()); + edit_play_deck->setPort(rda->station()->cuePort()); if(!edit_play_deck->setCart(edit_logline,false)) { return; } @@ -621,8 +621,8 @@ void RDCueEdit::UpdateCounters() void RDCueEdit::ClearChannel() { - if(edit_cae->playPortActive(edit_play_deck->card(),edit_play_deck->port(), - edit_play_deck->stream())) { + if(rda->cae()->playPortActive(edit_play_deck->card(),edit_play_deck->port(), + edit_play_deck->stream())) { return; } if((!edit_stop_rml.isEmpty())&&(edit_event_player!=NULL)) { diff --git a/lib/rdcueedit.h b/lib/rdcueedit.h index 7844fb15..3b62bbf4 100644 --- a/lib/rdcueedit.h +++ b/lib/rdcueedit.h @@ -2,7 +2,7 @@ // // Cueing Editor for RDLogLine-based Events // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -39,7 +39,7 @@ class RDCueEdit : public RDWidget { Q_OBJECT public: - RDCueEdit(RDCae *cae,int card,int port,QWidget *parent=0); + RDCueEdit(QWidget *parent=0); ~RDCueEdit(); QSize sizeHint() const; QSizePolicy sizePolicy() const; @@ -82,9 +82,6 @@ class RDCueEdit : public RDWidget RDEventPlayer *edit_event_player; QString edit_start_rml; QString edit_stop_rml; - RDCae *edit_cae; - int edit_play_card; - int edit_play_port; RDSlider *edit_slider; QLabel *edit_up_label; QLabel *edit_down_label; diff --git a/lib/rdcueeditdialog.cpp b/lib/rdcueeditdialog.cpp index 3c5dbb27..7724cd81 100644 --- a/lib/rdcueeditdialog.cpp +++ b/lib/rdcueeditdialog.cpp @@ -2,7 +2,7 @@ // // A Dialog Box for using an RDCueEdit widget. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -32,7 +32,7 @@ RDCueEditDialog::RDCueEditDialog(RDCae *cae,int play_card,int play_port, // // Cue Editor // - cue_edit=new RDCueEdit(cae,play_card,play_port,this); + cue_edit=new RDCueEdit(this); cue_edit->setGeometry(15,10, cue_edit->sizeHint().width(), cue_edit->sizeHint().height()); diff --git a/rdairplay/button_log.cpp b/rdairplay/button_log.cpp index bbb8b81f..84885afe 100644 --- a/rdairplay/button_log.cpp +++ b/rdairplay/button_log.cpp @@ -2,7 +2,7 @@ // // The button log widget for RDAirPlay // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,13 +20,12 @@ #include "button_log.h" -ButtonLog::ButtonLog(RDLogPlay *log,RDCae *cae,int id,RDAirPlayConf *conf, - bool allow_pause,QWidget *parent) +ButtonLog::ButtonLog(RDLogPlay *log,int id,RDAirPlayConf *conf,bool allow_pause, + QWidget *parent) : RDWidget(parent) { log_id=id; log_log=log; - log_cae=cae; log_action_mode=RDAirPlayConf::Normal; log_op_mode=RDAirPlayConf::LiveAssist; log_time_mode=RDAirPlayConf::TwentyFourHour; @@ -46,7 +45,7 @@ ButtonLog::ButtonLog(RDLogPlay *log,RDCae *cae,int id,RDAirPlayConf *conf, // // Edit Event Dialog // - log_event_edit=new EditEvent(log_log,log_cae,this); + log_event_edit=new EditEvent(log_log,this); // // Line Boxes / Start Buttons diff --git a/rdairplay/button_log.h b/rdairplay/button_log.h index 4b9f7c4c..b8bdc40e 100644 --- a/rdairplay/button_log.h +++ b/rdairplay/button_log.h @@ -2,7 +2,7 @@ // // The button play widget for RDAirPlay. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -37,8 +37,8 @@ class ButtonLog : public RDWidget { Q_OBJECT public: - ButtonLog(RDLogPlay *log,RDCae *cae,int id,RDAirPlayConf *conf, - bool allow_pause=false,QWidget *parent=0); + ButtonLog(RDLogPlay *log,int id,RDAirPlayConf *conf,bool allow_pause=false, + QWidget *parent=0); QSize sizeHint() const; QSizePolicy sizePolicy() const; RDAirPlayConf::OpMode opMode() const; @@ -79,7 +79,6 @@ class ButtonLog : public RDWidget int log_line_counter; RDAirPlayConf::TimeMode log_time_mode; EditEvent *log_event_edit; - RDCae *log_cae; bool log_pause_enabled; }; diff --git a/rdairplay/edit_event.cpp b/rdairplay/edit_event.cpp index 194fb791..7edc2474 100644 --- a/rdairplay/edit_event.cpp +++ b/rdairplay/edit_event.cpp @@ -2,7 +2,7 @@ // // Event Editor for RDAirPlay // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -23,11 +23,10 @@ #include "edit_event.h" -EditEvent::EditEvent(RDLogPlay *log,RDCae *cae,QWidget *parent) +EditEvent::EditEvent(RDLogPlay *log,QWidget *parent) : RDDialog(parent) { edit_log=log; - edit_cae=cae; edit_height=385; setWindowTitle("RDAirPlay - "+tr("Edit Event")); @@ -112,8 +111,7 @@ EditEvent::EditEvent(RDLogPlay *log,RDCae *cae,QWidget *parent) // // Cue Editor // - edit_cue_edit=new RDCueEdit(edit_cae,rda->station()->cueCard(), - rda->station()->cuePort(),this); + edit_cue_edit=new RDCueEdit(this); // // Cart Notes diff --git a/rdairplay/edit_event.h b/rdairplay/edit_event.h index 03239653..4485fc5d 100644 --- a/rdairplay/edit_event.h +++ b/rdairplay/edit_event.h @@ -2,7 +2,7 @@ // // Event Editor for RDAirPlay // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -36,7 +36,7 @@ class EditEvent : public RDDialog { Q_OBJECT public: - EditEvent(RDLogPlay *log,RDCae *cae,QWidget *parent=0); + EditEvent(RDLogPlay *log,QWidget *parent=0); ~EditEvent(); QSize sizeHint() const; QSizePolicy sizePolicy() const; @@ -78,7 +78,6 @@ class EditEvent : public RDDialog QPushButton *edit_cancel_button; QLabel *edit_horizrule_label; int edit_height; - RDCae *edit_cae; }; diff --git a/rdairplay/list_log.cpp b/rdairplay/list_log.cpp index ab1005e5..3e9e290e 100644 --- a/rdairplay/list_log.cpp +++ b/rdairplay/list_log.cpp @@ -35,13 +35,12 @@ #include "../icons/traffic.xpm" #include "../icons/music.xpm" -ListLog::ListLog(RDLogPlay *log,RDCae *cae,int id,bool allow_pause, +ListLog::ListLog(RDLogPlay *log,int id,bool allow_pause, QWidget *parent) : RDWidget(parent) { list_id=id; list_log=log; - list_cae=cae; list_op_mode=RDAirPlayConf::LiveAssist; list_action_mode=RDAirPlayConf::Normal; list_time_mode=RDAirPlayConf::TwentyFourHour; @@ -358,7 +357,7 @@ ListLog::ListLog(RDLogPlay *log,RDCae *cae,int id,bool allow_pause, // // Edit Event Dialog // - list_event_edit=new EditEvent(list_log,list_cae,this); + list_event_edit=new EditEvent(list_log,this); // // Map Slots diff --git a/rdairplay/list_log.h b/rdairplay/list_log.h index 911eec0c..1f0bea1c 100644 --- a/rdairplay/list_log.h +++ b/rdairplay/list_log.h @@ -2,7 +2,7 @@ // // The full log list widget for RDAirPlay. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -34,7 +34,7 @@ class ListLog : public RDWidget { Q_OBJECT public: - ListLog(RDLogPlay *log,RDCae *cae,int id,bool allow_pause=false, + ListLog(RDLogPlay *log,int id,bool allow_pause=false, QWidget *parent=0); QSize sizeHint() const; QSizePolicy sizePolicy() const; @@ -139,7 +139,6 @@ class ListLog : public RDWidget bool list_pause_allowed; bool list_audition_head_playing; bool list_audition_tail_playing; - RDCae *list_cae; }; diff --git a/rdairplay/rdairplay.cpp b/rdairplay/rdairplay.cpp index 82460827..c882017b 100644 --- a/rdairplay/rdairplay.cpp +++ b/rdairplay/rdairplay.cpp @@ -623,7 +623,7 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent) // air_pause_enabled=rda->airplayConf()->pauseEnabled(); for(int i=0;icae(),i,air_pause_enabled,this); + air_log_list[i]=new ListLog(air_log[i],i,air_pause_enabled,this); air_log_list[i]->setGeometry(510,140,air_log_list[i]->sizeHint().width(), air_log_list[i]->sizeHint().height()); air_log_list[i]->hide(); @@ -690,8 +690,8 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent) // // Button Log // - air_button_list=new ButtonLog(air_log[0],rda->cae(),0,rda->airplayConf(), - air_pause_enabled,this); + air_button_list= + new ButtonLog(air_log[0],0,rda->airplayConf(),air_pause_enabled,this); air_button_list->setGeometry(10,140,air_button_list->sizeHint().width(), air_button_list->sizeHint().height()); connect(air_button_list,SIGNAL(selectClicked(int,int,RDLogLine::Status)),