Updating row on QTableWidget cause segmentation fault
I have QTableWidget connected with `totale()` slot and [itemChanged(QTableWidgetItem *)][1] signal, in my table I am tracking user change on column 3 and 5.

    void Store::totale(QTableWidgetItem *x)
    {
        int row = x->row();
        float sum = 0;
        float ttl = 0;
        QTableWidgetItem *item = NULL;
        if (ui->storeTab->currentIndex() == 1)
        {
            if(x->column() == 5)
            {
                item = new QTableWidgetItem;
                sum = ui->itemsTableWidget->item(row, 3)->text().toFloat() * x->data(0).toFloat();
                item->setText(QString::number(sum, 'f', 2));
                ui->itemsTableWidget->setItem(x->row(), 6, item);
                sum = 0;
                for (int i = 0; i < ui->itemsTableWidget->rowCount(); ++i)
                {
                    ttl += ui->itemsTableWidget->item(i, 5)->text().toFloat();
                    sum += ui->itemsTableWidget->item(i, 6)->text().toFloat();
                }
                ui->totaleBill0->setText(QString::number(sum, 'f', 2));
                ui->ttlBill0->setText(QString::number(ttl, 'f', 2));
            }
            else if(x->column() == 3)
            {
                item = new QTableWidgetItem;
                sum = x->data(Qt::DisplayRole).toFloat() * ui->itemsTableWidget->item(row, 5)->text().toFloat();
                item->setText(QString::number(sum, 'f', 2));
                ui->itemsTableWidget->setItem(x->row(), 6, item);
                sum = 0;
                for (int i = 0; i < ui->itemsTableWidget->rowCount(); ++i)
                {
                    ttl += ui->itemsTableWidget->item(i, 5)->text().toFloat();
                    sum += ui->itemsTableWidget->item(i, 6)->text().toFloat();
                }
                ui->totaleBill0->setText(QString::number(sum, 'f', 2));
                ui->ttlBill0->setText(QString::number(ttl, 'f', 2));
            }
        }
    }

My problem if I make change on column 5, it works fine, but when I made change on column 3 I get segmentation fault. 


  [1]: http://doc.qt.nokia.com/4.7-snapshot/qtablewidget.html
Updating row on QTableWidget cause segmentation fault
===

I have QTableWidget connected with `totale()` slot and [itemChanged(QTableWidgetItem *)][1] signal, in my table I am tracking user change on column 3 and 5.

    void Store::totale(QTableWidgetItem *x)
    {
        int row = x->row();
        float sum = 0;
        float ttl = 0;
        QTableWidgetItem *item = NULL;
        if (ui->storeTab->currentIndex() == 1)
        {
            if(x->column() == 5)
            {
                item = new QTableWidgetItem;
                sum = ui->itemsTableWidget->item(row, 3)->text().toFloat() * x->data(0).toFloat();
                item->setText(QString::number(sum, 'f', 2));
                ui->itemsTableWidget->setItem(x->row(), 6, item);
                sum = 0;
                for (int i = 0; i < ui->itemsTableWidget->rowCount(); ++i)
                {
                    ttl += ui->itemsTableWidget->item(i, 5)->text().toFloat();
                    sum += ui->itemsTableWidget->item(i, 6)->text().toFloat();
                }
                ui->totaleBill0->setText(QString::number(sum, 'f', 2));
                ui->ttlBill0->setText(QString::number(ttl, 'f', 2));
            }
            else if(x->column() == 3)
            {
                item = new QTableWidgetItem;
                sum = x->data(Qt::DisplayRole).toFloat() * ui->itemsTableWidget->item(row, 5)->text().toFloat();
                item->setText(QString::number(sum, 'f', 2));
                ui->itemsTableWidget->setItem(x->row(), 6, item);
                sum = 0;
                for (int i = 0; i < ui->itemsTableWidget->rowCount(); ++i)
                {
                    ttl += ui->itemsTableWidget->item(i, 5)->text().toFloat();
                    sum += ui->itemsTableWidget->item(i, 6)->text().toFloat();
                }
                ui->totaleBill0->setText(QString::number(sum, 'f', 2));
                ui->ttlBill0->setText(QString::number(ttl, 'f', 2));
            }
        }
    }

My problem if I make change on column 5, it works fine, but when I made change on column 3 I get segmentation fault. 


  [1]: http://doc.qt.nokia.com/4.7-snapshot/qtablewidget.html