malloc crash

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

malloc crash

Post by seasoned_geek »

Maybe this should have never worked? It was working flawlessly until I pulled down the update for CopperSpice mentioned in this thread.

"Failed to create xcb gl-integration"

I happened to use the colors dialog again today and then spent some time chasing my tail.

Code: Select all

void Dialog_Colors::copyClicked()
{
    QString destName;
    bool okFlag = false;

    //  TODO:: Really need to get an AlphaNumeric hint added
    destName = QInputDialog::getText( this, "New Theme name", "Name: ", QLineEdit::Normal,
                                      destName, &okFlag, Qt::Dialog, Qt::ImhNone );

    // TODO:: Need duplicate check here
    if ( okFlag && ( destName > " " ) )
    {
        bool abortFlag = false;

        while ( nameCollision( destName, abortFlag ) && !abortFlag );

        m_localSettings.copyTheme( m_ui->theme_comboBox->currentText(), destName );
        rebuildComboBox( true );
    }
}
The above worked flawlessly. Today it caused a crash deep inside of malloc.c.

After quite a bit of bewilderment and hacking I changed the if statement on a desperate whim.

Code: Select all

if ( okFlag && !destName.isEmpty() )
I was using the previous test because there was a "feature" at one time in Qt where isEmpty() was only true on construction. If myString = ""; was executed the string would be empty but isEmpty() would return false.

I modified my cs_hello test program which can be found here: https://www.logikalsolutions.com/wordpress/uncategorized/copperspice-experiments-pt-8/

Code: Select all

void Task::run()
{
    // Do processing here

    QString destName;

    qDebug() << "Hello World!";

    if (destName > " " )
        {
                qDebug() << "dest greater";
        }
        else
        {
                qDebug() << "dest not greater";
        }

    emit finished();
}
After building

Code: Select all

roland@roland-amd-desktop:~/Projects/cs_hello_debug$ ./cs_hello
Hello World!
Segmentation fault (core dumped)

barbara
Posts: 200
Joined: Sat Apr 04 2015 2:32 am

Re: malloc crash

Post by barbara »

This issue turned out to be an obscure string issue and was resolved in the release of CopperSpice 1.7.0.

Barbara

Post Reply