Error reading characters of string

I used Singleton pattern for Songs class

class Songs
{
public:
static Songs* getInstanceSongs();
private:
CC_SYNTHESIZE(int , _timeSong, TimeSong);
CC_SYNTHESIZE(int , _speedSong, SpeedSong);
CC_SYNTHESIZE(CCString* , _songTitle, SongTitle);
};

In LevelSelectScene, i create instance of Songs (_songs) and i replace this scene by GameMainScene when click button Next.
I getSongTitle() from gameMainScene it worked good. But when i use getSongTitle() from ResultScence (is replace of GameMainScene) throw error: Error reading characters of string , (value of _timeSong and _speedSong is conrect), according to image below:

How to fix error? Tks.

Use CC_SYNTHESIZE_RETAIN for SongTitle, and make sure you never directly set _songTitle (use the get/set methods, because they will take care of retain/release).

1 Like

Yes, i fixed it.