Don't leak MimeData object
ClosedPublic

Authored by davidedmundson on May 29 2017, 9:34 PM.

Details

Summary

A DeclarativeDropArea creates a new DeclarativeDragDropEvent on every
enter/move/leave event.

The getter method for the mimeData property creates a new MimeData
QObject wrapper, which then leaks.

Use of the mimeData object outside of the event shouldn't be expected to
work, and a quick grep couldn't find any usage.

BUG: 380270

Test Plan

Dragged some things

Diff Detail

Repository
R296 KDeclarative
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.May 29 2017, 9:34 PM
Restricted Application added projects: Plasma, Frameworks. · View Herald TranscriptMay 29 2017, 9:34 PM
Restricted Application added subscribers: Frameworks, plasma-devel. · View Herald Transcript
mart accepted this revision.May 31 2017, 9:03 AM
This revision is now accepted and ready to land.May 31 2017, 9:03 AM
hein added a subscriber: hein.May 31 2017, 9:03 AM

So you're cleaning up the leak the next time the getter is accessed? What if this never happens?

So you're cleaning up the leak the next time the getter is accessed?

No? If it's accessed again m_data is not null so we don't get in that branch

The main cleanup is implicitly in the DeclarativeDropEvent destructor

hein accepted this revision.May 31 2017, 9:06 AM

Sounds good

This revision was automatically updated to reflect the committed changes.