@@ -90,6 +90,7 @@ QVariant MockNotificationModel::data(const QModelIndex &index, int role) const {
92void MockNotificationModel::append(MockNotification* n) {
92void MockNotificationModel::append(MockNotification* n) {
93+ QQmlEngine::setObjectOwnership(n, QQmlEngine::CppOwnership);
93 int location = m_queue.size();
94 int location = m_queue.size();
94 QModelIndex insertionPoint = QModelIndex();
95 QModelIndex insertionPoint = QModelIndex();
95 beginInsertRows(insertionPoint, location, location);
96 beginInsertRows(insertionPoint, location, location);
@@ -98,9 +99,10 @@ void MockNotificationModel::append(MockNotification* n) {
100MockNotification* MockNotificationModel::getNotification(int id) const {
101MockNotification* MockNotificationModel::getNotification(int id) const {
101− for(int i=0; i < m_queue.size(); i++) {
102+ for(int i = 0; i < m_queue.size(); i++) {
103+ MockNotification* n = m_queue.at(i);
102− if(m_queue[i]->getID() == id) {
104+ if(n && n->getID() == id) {
103− return m_queue[i];
105+ return n;
@@ -130,14 +132,7 @@ void MockNotificationModel::removeInternal(int loc) {
132MockNotification* MockNotificationModel::getRaw(const int notificationId) const {
134MockNotification* MockNotificationModel::getRaw(const int notificationId) const {
133− for(int i = 0; i < m_queue.size(); i++) {
134− if(m_queue[i]->getID() == notificationId) {
135+ return getNotification(notificationId);
135− MockNotification* n = m_queue[i];
143int MockNotificationModel::queued() const {
138int MockNotificationModel::queued() const {