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)
|
||||
{
|
||||
[m_cursor release];
|
||||
if (m_cursor)
|
||||
{
|
||||
[m_cursor release];
|
||||
m_cursor = nil;
|
||||
}
|
||||
|
||||
NSSize nssize = NSMakeSize(size.x, size.y);
|
||||
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)
|
||||
{
|
||||
[m_cursor release];
|
||||
if (m_cursor)
|
||||
{
|
||||
[m_cursor release];
|
||||
m_cursor = nil;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user