Hi!  The code below can make python seg fault. Steps to reproduce: run this program,modify the value of a cell, then click submit button,python will seg fault.The correct result is the value of the second column will change to 999 after click submit buttoon.<br>
<br>When I use PyQt 4.4,the crash will not happen.Under  PyQt 4.5/4.6,python does crash.      <br># -*- coding: utf-8 -*-<br>from PyQt4.QtGui import *<br>from PyQt4.QtCore import *<br>from PyQt4.QtSql import *<br>import sys<br>
def createConnection():<br>    db=QSqlDatabase.addDatabase(&quot;QSQLITE&quot;)<br>    db.setDatabaseName(&quot;test0.db&quot;)<br>    db.open()<br>    <br>def createTable():<br>    q=QSqlQuery()<br>    q.exec_(&quot;create table if not exists t1 (f1 integer primary key,f2 integer)&quot;)<br>
    q.exec_(&quot;delete from t1&quot;)<br>    q.exec_(&quot;insert into t1 values(1,0)&quot;)<br>    q.exec_(&quot;insert into t1 values(2,3)&quot;)<br>    q.exec_(&quot;commit&quot;)<br><br>    <br>class Model(QSqlTableModel):<br>
    def __init__(self,parent=None):<br>        QSqlTableModel.__init__(self,parent)<br>        self.setTable(&quot;t1&quot;)<br>        self.select()<br>        self.setEditStrategy(QSqlTableModel.OnManualSubmit)<br>        self.connect(self,SIGNAL(&quot;beforeUpdate(int,QSqlRecord&amp;)&quot;),<br>
                     self.beforeUpdateTable)<br>    def beforeUpdateTable(self,row,rec):<br>        rec.setValue(&quot;f1&quot;,999)<br>class TestWidget(QWidget):<br>    def __init__(self):<br>        QWidget.__init__(self)<br>
        vbox=QVBoxLayout(self)<br>        t=QTableView()<br>        m=Model()<br>        t.setModel(m)<br>        b=QPushButton(&quot;submit&quot;)<br>        vbox.addWidget(t)<br>        vbox.addWidget(b)<br>        self.connect(b,SIGNAL(&quot;clicked()&quot;),m.submitAll)<br>
def main():<br>    a=QApplication(sys.argv)<br>    createConnection()<br>    createTable()<br>    w=TestWidget()<br>    w.show()<br>    sys.exit(a.exec_())<br>if __name__==&quot;__main__&quot;:<br>    main()<br>    <br>