mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Fix potential crash when changing cursor - don't release the NSCursor object if it's already been released
This commit is contained in:
parent
9541719893
commit
f4844c11f8
@ -71,7 +71,11 @@ CursorImpl::~CursorImpl()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hotspot)
|
bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hotspot)
|
||||||
{
|
{
|
||||||
[m_cursor release];
|
if (m_cursor)
|
||||||
|
{
|
||||||
|
[m_cursor release];
|
||||||
|
m_cursor = nil;
|
||||||
|
}
|
||||||
|
|
||||||
NSSize nssize = NSMakeSize(size.x, size.y);
|
NSSize nssize = NSMakeSize(size.x, size.y);
|
||||||
NSImage* image = [NSImage imageWithRawData:pixels andSize:nssize];
|
NSImage* image = [NSImage imageWithRawData:pixels andSize:nssize];
|
||||||
@ -85,7 +89,11 @@ bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hot
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromSystem(Cursor::Type type)
|
bool CursorImpl::loadFromSystem(Cursor::Type type)
|
||||||
{
|
{
|
||||||
[m_cursor release];
|
if (m_cursor)
|
||||||
|
{
|
||||||
|
[m_cursor release];
|
||||||
|
m_cursor = nil;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user