forked from qt-creator/qt-creator
Core: Guard against pages that forgot to create their widgets
This should not happen, but when it happens, the resulting crash is quite cryptic. Make it a bit more obvious. Change-Id: Icbe40206cfdbae93ccb072d7027fcaf109f2f39f Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -132,6 +132,7 @@ QWidget *IOptionsPage::widget()
|
|||||||
if (!m_widget) {
|
if (!m_widget) {
|
||||||
if (m_widgetCreator) {
|
if (m_widgetCreator) {
|
||||||
m_widget = m_widgetCreator();
|
m_widget = m_widgetCreator();
|
||||||
|
QTC_CHECK(m_widget);
|
||||||
} else if (m_settingsProvider) {
|
} else if (m_settingsProvider) {
|
||||||
m_widget = new IOptionsPageWidget;
|
m_widget = new IOptionsPageWidget;
|
||||||
AspectContainer *container = m_settingsProvider();
|
AspectContainer *container = m_settingsProvider();
|
||||||
|
|||||||
@@ -345,9 +345,12 @@ private:
|
|||||||
void showEvent(QShowEvent *event) final
|
void showEvent(QShowEvent *event) final
|
||||||
{
|
{
|
||||||
if (!widget()) {
|
if (!widget()) {
|
||||||
QWidget *inner = m_page->widget();
|
if (QWidget *inner = m_page->widget()) {
|
||||||
setWidget(inner);
|
setWidget(inner);
|
||||||
inner->setAutoFillBackground(false);
|
inner->setAutoFillBackground(false);
|
||||||
|
} else {
|
||||||
|
QTC_CHECK(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QScrollArea::showEvent(event);
|
QScrollArea::showEvent(event);
|
||||||
|
|||||||
Reference in New Issue
Block a user