QComboBox bug

Discuss anything related to product development
Post Reply
seasoned_geek
Posts: 108
Joined: Thu Jun 11 2020 12:18 pm

QComboBox bug

Post by seasoned_geek »

All,

Stumbled into this bug due to one of my bugs.

m_ui->themeComboBox->setCurrentIndex( m_ui->themeComboBox->findText( m_currentTheme->name() ) );

Basically if QComboBox::findText() cannot find the text and the result is directly used by QComboBox::setCurrentIndex() it neither errors out nor crashes as one would expect. Lassie simply never comes home.

Ubuntu 20.04 LTS with all updates applied and the latest tippy-tip of CopperSpice.

I also stumbled onto a Template bug for QString but didn't take screen shots and good notes so don't have a nice reproducible thing to show you.

Basically, if you have a method that accepts multiple parameters, one of which is a QString from a char * and that parameter is passed through several other methods you end up crashing at a template expecting char & [N]. How I got there was passing in a null pointer. Yes, it was the result of a problem elsewhere, but that should have still worked. When I get time I will try to reproduce the issue so it can be fixed.

The QComboBox issue should be easy to identify and "fix." In my mind, if you want to make "the fix" a deliberate crash or a more polite orderly path defaulting to the first item (or no item) in the list, that is fine. Lassie should come home though. I had this off in a dialog so it took quite a while to track down why the dialog didn't even display.

Post Reply