blackberry/Qt

Segmentation fault on clipboard clearing

dkonigsberg opened this issue · 1 comments

Calling the clear function on the clipboard, from within an app, will cause the app to crash with a SIGSEGV:
QApplication::clipboard()->clear(QClipboard::Clipboard);

The problem is that the implementation of this method calls QBBClipboard's setMimeData() function with a 0 for the data parameter, and that case is not handled before trying to dereference it.

The fix is simple. Just add "if(data == 0) return;" right after the call to "empty_clipboard();" inside of QBBClipboard::setMimeData().

Thanks for finding that! I'll post the fix right away.