BARCELONA, Spain — In 1969, Salvador Dalí, the Surrealist painter, gave a derelict castle to his Russian-born wife, Gala, as a present. She welcomed his generosity but also set rules for her new home in Púbol, a village in Catalonia.

Gala stipulated that her husband could visit the castle only if he had received a written invitation. “Sentimental rigor and distance — as demonstrated by the neurotic ceremony of courtly love — increase passion,” an acquiescent Dalí later wrote.

Image The castle in Púbol, Spain, where Gala Dalí lived. Her husband was not allowed to visit without a written invitation. Credit... Fundación Gala-Salvador Dalí, Figueres

The peculiar visiting ritual ordered by Gala is a well-known anecdote. But much else about Gala’s life, ambitions and desires remains unclear or subject to conflicting accounts, which probably explains why it has taken until this month for a museum to devote a full exhibition to her, even though she shared — and shaped — the lives of several key artists of the Surrealist movement. The exhibition, “Gala Salvador Dalí. A Room of One’s Own in Púbol,” runs through Oct. 14 at the National Art Museum of Catalonia, in Barcelona.