source: trunk/dports/www/QupZilla/files/patch-src-lib-preferences-preferences.cpp.diff @ 126330

Last change on this file since 126330 was 126330, checked in by ryandesign@…, 6 years ago

QupZilla: fix more runtime crashes

File size: 1.8 KB
  • src/lib/preferences/preferences.cpp

    Fix crash when opening Preferences with no browser window
    https://github.com/QupZilla/qupzilla/issues/1488
    https://github.com/QupZilla/qupzilla/commit/21fb7bff31a5b0d9cad1e4229ff3b03b84a9fefe
    old new Preferences::Preferences(BrowserWindow* window, QWidget* parent) 
    265265    bool pbInABuseCC = settings.value("UseCustomProgressColor", false).toBool();
    266266    ui->checkBoxCustomProgressColor->setChecked(pbInABuseCC);
    267267    ui->progressBarColorSelector->setEnabled(pbInABuseCC);
    268     QColor pbColor = settings.value("CustomProgressColor", m_window->palette().color(QPalette::Highlight)).value<QColor>();
     268    QColor pbColor = settings.value("CustomProgressColor", palette().color(QPalette::Highlight)).value<QColor>();
    269269    setProgressBarColorIcon(pbColor);
    270270    connect(ui->customColorToolButton, SIGNAL(clicked(bool)), SLOT(selectCustomProgressBarColor()));
    271271    connect(ui->resetProgressBarcolor, SIGNAL(clicked()), SLOT(setProgressBarColorIcon()));
    void Preferences::allowCacheChanged(bool state) 
    592592
    593593void Preferences::useActualHomepage()
    594594{
     595    if (!m_window)
     596        return;
     597
    595598    ui->homepage->setText(m_window->weView()->url().toString());
    596599}
    597600
    598601void Preferences::useActualNewTab()
    599602{
     603    if (!m_window)
     604        return;
     605
    600606    ui->newTabUrl->setText(m_window->weView()->url().toString());
    601607}
    602608
    void Preferences::setProgressBarColorIcon(QColor color) 
    11181124    const int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    11191125    QPixmap pm(QSize(size, size));
    11201126    if (!color.isValid()) {
    1121         color = m_window->palette().color(QPalette::Highlight);
     1127        color = palette().color(QPalette::Highlight);
    11221128    }
    11231129    pm.fill(color);
    11241130    ui->customColorToolButton->setIcon(pm);
Note: See TracBrowser for help on using the repository browser.