Storing the title in a string first has always been my work-around for this "problem". It can then be re-applied whenever the window is re-created (as when you change to fullscreen).
The added advantage to storing a string is that you can then add additional text that is more contextual. For example, the string would be the application name and then you could add information about the window after the title. Personally, I have used it to show feedback in the titlebar and still keeping the name
One thing to note is that you don't actually have to convert it to a c string to pass it to the window as korczurekk's code did.