The talks were tricky because of thorny contracts, some of which were signed many years ago when the original “Roseanne” television show was on the air.

ABC revived the show to great fanfare earlier this year, and it instantly became the No. 1 new show of the television season.

But Barr’s controversial behavior on Twitter was a constant headache for ABC. When she posted a racist comment about Valerie Jarrett and offensive comments about Chelsea Clinton and other political figures, the network decided it had to cancel the show.

The swift cancellation stunned the TV industry. The show’s writers were just about to return to work on the second season. ABC executives were out selling the new season to potential advertisers.

But the executives in charge of ABC and its parent company, Disney, felt that they had no choice but to cut ties with Barr.

And in the heat of the moment, there was no time to strike a deal for a Barr-less version of the show.

There were immediate regrets about the potential loss of 200-plus jobs. And there were almost immediate talks about some kind of possible revival.

Sure enough, “Roseanne” co-stars like John Goodman, Laurie Metcalf and Sara Gilbert were all interested in keeping the show going in some fashion.

In a joint statement on Thursday, the remaining cast members said, “We have received a tremendous amount of support from fans of our show, and it’s clear that these characters not only have a place in our hearts, but in the hearts and homes of our audience.”