tst_QApplication: Fix UBs (invalid cast) in focusMouseClick()
Found by UBSan: tst_qapplication.cpp:1754:48: runtime error: member access within address 0x7ffda11f2220 which does not point to an object of type 'SpontaneousEvent' 0x7ffda11f2220: note: object is of type 'QMouseEvent' The code attempted to model the layout of a QEvent with another class that allows public access to the memory location that (hopefully) corresponds to QEvent::spont, gaining access by casting a QEvent object to that specifically-crafted class. Fix by the using the existing QSpontaneKeyEvent::setSpontaneous() call, which, despite its name, works for all QEvent subclasses, and which has already been fixed to not invoke UB (in bc087db5 ). Change-Id: I7db8b8a8a823f7d61ab17375142d19dc3874fea5 Reviewed-by:Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Showing
Please register or sign in to comment