Actress Sara Gilbert has credited her former Roseanne and Big Bang Theory co-star Johnny Galecki with helping her come out as gay.

Gilbert, who once dated Galecki, explained on her show The Talk that she would often get “depressed” whenever they kissed.

She said: “I thought he was super cute and I had a total crush on him. And we started dating and he would come over and we would, like, make out, and then I would start to get depressed.”

She added: “I eventually told him I thought it was about my sexuality and he was super sweet about it.”

The 38-year-old came out in 2010, having been in a relationship with TV producer Allison Adler since 2001. The couple had two children together, but separated in August 2011.

“I started dating a woman who was like 18 years older than I was, who was also in the public eye. It was something people could have found out about. Like no one knew at the show for years, and Johnny held the secret the whole time.

“And I always felt so scared. If it came out, what could happen? Could I lose my career? Will I ever be able to play a straight role again?”

Gilbert revealed that she had contacted her friend Galecki to get his permission to discuss their relationship on TV.

“I called him and I just said, ‘Is it okay I’m thinking of talking about this. The story kind of starts with you. And I’ve got to say I made out with you and got depressed, which is kind of a bummer.’

“[He said] ‘Of course. I love you and I think it’s really important and I’m so proud of you. If you want, I will be there and I will hold your hand.’ It was so sweet, and this story really makes Johnny look good.”

She went on to say: “I want people to know there can still be a struggle with it and that’s okay. It’s a process and there can be a part of you that doesn’t want to feel different or feel scared.”

Gilbert is currently engaged to 4 Non Blondes singer Linda Perry. The couple announced their plans to wed in April this year.

British actor Rupert Everett has previously warned gay actors not to come out, arguing that doing so could harm their careers.