forked from qt-creator/qt-creator
ToolTip: Guard against nullptr access
screenAt(pos) can be nullptr if pos is outside the current screen configuration. Seems to be possible when screen configurations change. Fixes: QTCREATORBUG-26019 Change-Id: I5def200b14247e7fbcf62ad68cda991e8c10c9d7 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -156,7 +156,10 @@ void ToolTip::show(
|
||||
if (content && content->count()) {
|
||||
auto tooltipWidget = new FakeToolTip;
|
||||
// limit the size of the widget to 90% of the screen size to have some context around it
|
||||
tooltipWidget->setMaximumSize(QGuiApplication::screenAt(pos)->availableSize() * 0.9);
|
||||
QScreen *qscreen = QGuiApplication::screenAt(pos);
|
||||
if (!qscreen)
|
||||
qscreen = QGuiApplication::primaryScreen();
|
||||
tooltipWidget->setMaximumSize(qscreen->availableSize() * 0.9);
|
||||
if (contextHelp.isNull()) {
|
||||
tooltipWidget->setLayout(content);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user