Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.5.1
-
None
-
Doc note: a45673978627fc1ee4ba336caf545b56d44dedec (qtbase/5.8, 30.9.2016,5.8)
Description
Given the following use case
const QMimeData * data = qApp->clipboard()->mimeData(); qApp->clipboard()->setText("anything"); doSomething(data); // here, data has potentially been deleted under the hood.
This popped up because I needed to temporarily put something on the system clipboard (interacting with an external application with a less than desirable interface), which lead to fairly consistent crashes. Originally, doSomething was making a copy and setting on the clipboard. The solution seems to have been to make a copy before changing the clipboard, but the clipboard changing is potentially outside of the control of the programmer. Can either a. the documentation be updated and/or b. some sort of QMimeData copy mechanism be introduced?