Ownership fix for QtChildEvent

When created using initWithType🧒, it should take ownership of the
underlying QChildEvent.
This commit is contained in:
Jonathan Schleifer 2017-04-09 14:20:40 +02:00
parent daa49494d4
commit 97c281547c
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3
2 changed files with 6 additions and 2 deletions

View file

@ -24,7 +24,7 @@ HEADERS += common/helpers.h \
SOURCES += common/OFString+QString.mm \
QtCore/QtChildEvent.mm \
QtCore/QtCoreApplication.mm \
QtCore/QtCoreApplication.mm \
QtCore/QtEvent.mm \
QtCore/QtObject.mm \
QtCore/QtThread.mm \

View file

@ -16,8 +16,12 @@
child: (QtObject*)child
{
try {
return [self initWithQChildEvent:
self = [self initWithQChildEvent:
new QChildEvent(type, [child qObject])];
[self takeOwnership];
return self;
} catch (const std::bad_alloc &e) {
self = [super initWithQEvent: NULL];
[self release];