[*] Harden Qt6.7 (2023/11)

Change-Id: Ibf3e7161e31418e4fbcddfdd3f7d5c99ba5a82b3
This commit is contained in:
Reece Wilson 2024-11-17 00:53:41 +00:00
parent 04403770e6
commit 65e977f062
2 changed files with 35 additions and 23 deletions

View File

@ -1133,10 +1133,10 @@ bool QCoreApplication::notifyInternal2(QObject *receiver, QEvent *event)
if (!selfRequired)
return doNotify(receiver, event);
#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0)
//#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0)
if (threadData->thread.loadRelaxed() != QCoreApplicationPrivate::mainThread())
return false;
#endif
//#endif
return self->notify(receiver, event);
}

View File

@ -545,6 +545,8 @@ void QLayout::widgetEvent(QEvent *e)
}
break;
case QEvent::LayoutRequest:
if (!parent())
break;
if (static_cast<QWidget *>(parent())->isVisible())
activate();
break;
@ -579,11 +581,13 @@ int QLayout::totalMinimumHeightForWidth(int w) const
int side=0, top=0;
if (d->topLevel) {
QWidget *parent = parentWidget();
if (d->topLevel) {
parent->ensurePolished();
QWidgetPrivate *wd = parent->d_func();
side += wd->leftmargin + wd->rightmargin;
top += wd->topmargin + wd->bottommargin;
}
}
int h = minimumHeightForWidth(w - side) + top;
#if QT_CONFIG(menubar)
h += menuBarHeightForWidth(d->menubar, w);
@ -601,11 +605,13 @@ int QLayout::totalHeightForWidth(int w) const
int side=0, top=0;
if (d->topLevel) {
QWidget *parent = parentWidget();
if (parent) {
parent->ensurePolished();
QWidgetPrivate *wd = parent->d_func();
side += wd->leftmargin + wd->rightmargin;
top += wd->topmargin + wd->bottommargin;
}
}
int h = heightForWidth(w - side) + top;
#if QT_CONFIG(menubar)
h += menuBarHeightForWidth(d->menubar, w);
@ -623,11 +629,13 @@ QSize QLayout::totalMinimumSize() const
int side=0, top=0;
if (d->topLevel) {
QWidget *pw = parentWidget();
if (pw) {
pw->ensurePolished();
QWidgetPrivate *wd = pw->d_func();
side += wd->leftmargin + wd->rightmargin;
top += wd->topmargin + wd->bottommargin;
}
}
QSize s = minimumSize();
#if QT_CONFIG(menubar)
@ -646,11 +654,13 @@ QSize QLayout::totalSizeHint() const
int side=0, top=0;
if (d->topLevel) {
QWidget *pw = parentWidget();
if (pw) {
pw->ensurePolished();
QWidgetPrivate *wd = pw->d_func();
side += wd->leftmargin + wd->rightmargin;
top += wd->topmargin + wd->bottommargin;
}
}
QSize s = sizeHint();
if (hasHeightForWidth())
@ -671,11 +681,13 @@ QSize QLayout::totalMaximumSize() const
int side=0, top=0;
if (d->topLevel) {
QWidget *pw = parentWidget();
if (pw) {
pw->ensurePolished();
QWidgetPrivate *wd = pw->d_func();
side += wd->leftmargin + wd->rightmargin;
top += wd->topmargin + wd->bottommargin;
}
}
QSize s = maximumSize();
#if QT_CONFIG(menubar)
@ -972,7 +984,7 @@ void QLayout::update()
QLayout *layout = this;
while (layout && layout->d_func()->activated) {
layout->d_func()->activated = false;
if (layout->d_func()->topLevel) {
if (layout->d_func()->topLevel && layout->parent()) {
Q_ASSERT(layout->parent()->isWidgetType());
QWidget *mw = static_cast<QWidget*>(layout->parent());
if (mw) { /*we always validate layout later, implying it can be null. why the fuck were the Qt devs copying the [~volatile~] parent multiple times and using it without a check?