Custom control causes crash in QT5 on dual screen system.
- Lazarus/FPC Version: <Lazarus 2.3.0 (rev main-2_3-1333-g914219e9) FPC 3.2.2 x86_64-linux-qt5>
- Operating System: <Fedora 34 with KDE>
- CPU / Bitness: <64>
- QT version 5.15.2
On loading the attached test project the Lazarus IDE (QT5 widget set) fails "with Access violation". On running the project the project crashes with SIGSEGV.
What did you expect
Lazarus loads, compiles and runs the project.
Steps to reproduce
Unzip Tracker.tar.gz in a directory In Lazarus open the DTrackbar package. Compile and install the package. Open the project TestDTrackBar.lpi on the external or second monitor Lazarus fails with "Access Violation", select "Continue" Compile and run TestDTrackBar. Project fails with SIGSEGV.
In: commit 9786f792 Author: zeljko Date: Wed Apr 8 08:22:39 2020 +0000
Qt5: implemeted TQtWidget.grabWindow(), added check if FContext is 0 in Paint event. git-svn-id: trunk@62911 -
zeljko created TWidget.grabWindow and in commit a64938e0 Author: zeljko Date: Wed Apr 8 13:20:36 2020 +0000
Qt5: simplified RawImage_fromDevice() git-svn-id: trunk@62915 -
he used it. Reverting these two commits solves the problem of the controls crashing on the second monitor.
In qtlclintf.inc prior to these two commits you have the comment in line 785 in function TQtWidgetSet.RawImage_FromDevice // if you have dual monitors then getDeviceSize return // more width than screen width, but grabWindow will only grab one // screen, so its width will be less // Solution: we can either pass prefered size to grabWindow or // correct Description size after. I see the first solution as more correct.
I suspect that TQtWidget.grabWindow() is getting an inconsistent screen size on some dual monitor systems.
For more details see: https://forum.lazarus.freepascal.org/index.php/topic,59325.15.html