I have no problem with sendToClipboard so far, but my implemenation of retriveveFromClipboard will have memory leak.
SDL's SDL_GetClipboardText() returns a UTF-8 char*, but it must be freed using SDL_free() later. The thing is I don't know when to delete the char* returned by SDL.
Here's my code:
Code: Select all
void SDLClipboardProvider::retrieveFromClipboard(String & mimeType, void *& buffer, size_t & size)
mimeType = "text/plain";
char* text = SDL_GetClipboardText();
buffer = text;
size = strlen(text);