@@ -169,11 +169,13 @@ namespace SDL {
169169
170170 Cursor::Cursor () {
171171 this ->cursor = SDL_CreateSystemCursor (SDL_SYSTEM_CURSOR_ARROW);
172+ this ->has_control = true ;
172173 }
173174
174175 Cursor::Cursor (Cursor&& other) {
175176 this ->cursor = other.cursor ;
176177 other.has_control = false ;
178+ this ->has_control = true ;
177179 }
178180
179181 Cursor::Cursor (
@@ -196,13 +198,15 @@ namespace SDL {
196198 return {false , *current_element};
197199 }
198200 );
201+ this ->has_control = true ;
199202 }
200203
201204 Cursor::Cursor (
202205 const std::initializer_list<std::string> l,
203206 const Vector2s c
204207 ) {
205208 this ->cursor = string_list_to_cursor (l, c);
209+ this ->has_control = true ;
206210 }
207211
208212 Cursor::Cursor (
@@ -236,22 +240,26 @@ namespace SDL {
236240 }
237241 }
238242 );
243+ this ->has_control = true ;
239244 }
240245
241246 Cursor::Cursor (const std::string s, const Vector2s c) {
242247 this ->cursor = string_list_to_cursor (_implementation::cursor::split (s), c);
248+ this ->has_control = true ;
243249 }
244250
245251 Cursor::Cursor (Surface& s, Vector2s c) {
246252 this ->cursor = SDL_CreateColorCursor (s.sdl_surface , c[0 ], c[1 ]);
253+ this ->has_control = true ;
247254 }
248255
249256 Cursor::Cursor (const SDL_SystemCursor c) {
250257 this ->cursor = SDL_CreateSystemCursor (c);
258+ this ->has_control = true ;
251259 }
252260
253261 Cursor::~Cursor () {
254- if (this ->has_control )
262+ if (this ->has_control ) // We don't want to free cursors that were moved.
255263 SDL_FreeCursor (this ->cursor );
256264 }
257265
0 commit comments