rem: if (ectrl.is_selected()) ectrl.remove_chainsetup();
add: DBC_CHECK(ectrl.is_connected() != true); if (ectrl.is_selected()) {  ectrl.remove_chainsetup();  }
context: int main(int argc, char *argv[]){  ECA_LOGGER::instance().disable();  // ECA_LOGGER::instance().set_log_level(ECA_LOGGER::errors, true);  // ECA_LOGGER::instance().set_log_level(ECA_LOGGER::info, true);  // ECA_LOGGER::instance().set_log_level(ECA_LOGGER::subsystems, true);  struct sigaction es_handler_int;  es_handler_int.sa_handler = signal_handler;  sigemptyset(&es_handler_int.sa_mask);  es_handler_int.sa_flags = 0;  struct sigaction ign_handler;  ign_handler.sa_handler = SIG_IGN;  sigemptyset(&ign_handler.sa_mask);  ign_handler.sa_flags = 0;  /* handle the follwing signals explicitly */  sigaction(SIGINT, &es_handler_int, 0);  /* ignore the following signals */  sigaction(SIGPIPE, &ign_handler, 0);  COMMAND_LINE cline = COMMAND_LINE (argc, argv);  if (cline.size() < 2) {    print_usage();    return(1);  }  cline.combine();    PROCEDURE_TIMER ptimer;  ecaplay_ptimer_repp = &ptimer;  struct timeval lowerlimit;  ecaplay_lowerlimit_repp = &lowerlimit;  lowerlimit.tv_sec = 1;  lowerlimit.tv_usec = 0;  try {    ECA_SESSION esession;    ECA_CONTROL ectrl (&esession);    ecaplay_ectrl_repp = &ectrl;    ECA_AUDIO_FORMAT aio_params;    cline.begin();    cline.next(); // skip the program name    ecaplay_total_files = cline.size() - 1;    int playing_file = 0;    int consecutive_errors = 0;    while(cline.end() == false &&	  ecaplay_exit_request_rep == 0) {      // --      // parse command-line options      if (cline.current().size() > 1 &&	  cline.current()[0] == '-') {	int ret = process_option(cline.current());	if (ret != 0) return(ret);	cline.next();	--ecaplay_total_files;	continue;      }            string filename = cline.current();      ++playing_file;      if (ecaplay_skip_files == 0) {	std::cout << "(ecaplay) Playing file '" << filename << "'";        std::cout << " (" << playing_file;	std::cout << "/" << ecaplay_total_files;	std::cout << ")." << endl;      }      else {	std::cout << "(ecaplay) Skipping file '" << filename << "'." << endl;	--ecaplay_skip_files;	cline.next();	continue;      }      ectrl.add_chainsetup("default");      ectrl.add_chain("default");      ectrl.add_audio_input(filename);      if (ectrl.get_audio_input() == 0) {	cerr << "(ecaplay) " << ectrl.last_error() << endl;	cerr << "(ecaplay) Error! Skipping file " << filename << "." << endl;      }      else {	ectrl.set_default_audio_format_to_selected_input();	aio_params = ectrl.default_audio_format();	ectrl.set_chainsetup_parameter("-sr:" + kvu_numtostr(aio_params.samples_per_second()));	ectrl.add_default_output();	ectrl.connect_chainsetup();	if (ectrl.is_connected() != true) {	  cerr << "(ecaplay) " << ectrl.last_error() << endl;	  cerr << "(ecaplay) Error while playing file " << filename << ". Skipping...\n";	  ++consecutive_errors;	  if (consecutive_errors == 3) {	    cerr << "(ecaplay) Too many errors, exiting." << endl;	    ectrl.remove_chainsetup();	    break;	  }	}	else {	  consecutive_errors = 0;	  ectrl.run();	  if (ectrl.is_connected() == true) ectrl.disconnect_chainsetup();	}      }      if (ectrl.is_selected()) ectrl.remove_chainsetup();      cline.next();    }  }  catch(...) {    cerr << "\n(ecaplay) Caught an unknown exception.\n";  }  return(0);}