Crash when copying and pasting in several editors (sprite, map editor) #558
This commit is contained in:
		@@ -590,7 +590,7 @@ static void copyFromClipboard(Code* code)
 | 
			
		||||
				parseSyntaxColor(code);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			free(clipboard);
 | 
			
		||||
			getSystem()->freeClipboardText(clipboard);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1004,7 +1004,7 @@ static void copyFromClipboard(Map* map)
 | 
			
		||||
				else free(data);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			free(clipboard);
 | 
			
		||||
			getSystem()->freeClipboardText(clipboard);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -651,7 +651,7 @@ static void copyFromClipboard(Music* music)
 | 
			
		||||
				free(data);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			free(clipboard);
 | 
			
		||||
			getSystem()->freeClipboardText(clipboard);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -417,7 +417,7 @@ bool fromClipboard(void* data, s32 size, bool flip, bool remove_white_spaces)
 | 
			
		||||
 | 
			
		||||
				if(valid) str2buf(clipboard, strlen(clipboard), data, flip);
 | 
			
		||||
 | 
			
		||||
				free(clipboard);
 | 
			
		||||
				getSystem()->freeClipboardText(clipboard);
 | 
			
		||||
 | 
			
		||||
				return valid;
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -876,6 +876,11 @@ static char* getClipboardText()
 | 
			
		||||
	return SDL_GetClipboardText();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void freeClipboardText(const char* text)
 | 
			
		||||
{
 | 
			
		||||
	SDL_free((void*)text);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static u64 getPerformanceCounter()
 | 
			
		||||
{
 | 
			
		||||
	return SDL_GetPerformanceCounter();
 | 
			
		||||
@@ -1057,6 +1062,8 @@ static System systemInterface =
 | 
			
		||||
	.setClipboardText = setClipboardText,
 | 
			
		||||
	.hasClipboardText = hasClipboardText,
 | 
			
		||||
	.getClipboardText = getClipboardText,
 | 
			
		||||
	.freeClipboardText = freeClipboardText,
 | 
			
		||||
 | 
			
		||||
	.getPerformanceCounter = getPerformanceCounter,
 | 
			
		||||
	.getPerformanceFrequency = getPerformanceFrequency,
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,8 @@ typedef struct
 | 
			
		||||
	void	(*setClipboardText)(const char* text);
 | 
			
		||||
	bool	(*hasClipboardText)();
 | 
			
		||||
	char* 	(*getClipboardText)();
 | 
			
		||||
	void 	(*freeClipboardText)(const char* text);
 | 
			
		||||
 | 
			
		||||
	u64 	(*getPerformanceCounter)();
 | 
			
		||||
	u64 	(*getPerformanceFrequency)();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -517,6 +517,11 @@ static char* getClipboardText()
 | 
			
		||||
	return SDL_GetClipboardText();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void freeClipboardText(const char* text)
 | 
			
		||||
{
 | 
			
		||||
	SDL_free((void*)text);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static u64 getPerformanceCounter()
 | 
			
		||||
{
 | 
			
		||||
	return SDL_GetPerformanceCounter();
 | 
			
		||||
@@ -599,6 +604,8 @@ static System systemInterface =
 | 
			
		||||
	.setClipboardText = setClipboardText,
 | 
			
		||||
	.hasClipboardText = hasClipboardText,
 | 
			
		||||
	.getClipboardText = getClipboardText,
 | 
			
		||||
	.freeClipboardText = freeClipboardText,
 | 
			
		||||
	
 | 
			
		||||
	.getPerformanceCounter = getPerformanceCounter,
 | 
			
		||||
	.getPerformanceFrequency = getPerformanceFrequency,
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user