<div dir="ltr">
        <meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">
        <title></title>
        <meta name="GENERATOR" content="OpenOffice.org 2.4 (Unix)">
        <style type="text/css">
        <!--
                @page { size: 21cm 29.7cm; margin: 2cm }
                P { margin-bottom: 0.21cm }
        -->
        </style>
<p style="margin-bottom: 0cm;">It's awhile that I'm struggling with a
strange behavior of my code on different platforms.<br><br>My program
is a GUI to a sqlite db that uses PyQt4 API's to access it.<br>In
different situations it looks like it is working correctly (no error,
coherent db management at run-time) but when it ends no db
modification is written to disk (and I find a db-journal nearby my db
file).<br><br>At the beginning I noticed that it worked onto some
platforms and it didn't on others<br>[
<a href="http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg14774.html">http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg14774.html</a>
].<br><br>Then I found which was the part of code responsible for the
wrong behavior<br>[
<a href="http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg14883.html">http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg14883.html</a>
].<br><br>After avoiding the use of lambda forms, and proceeding in
my code development, I found an other statement that produced exactly
the same problem: it was a simple reference to an owner object.<br>I
will explain it.<br>1- when my application starts it instantiates a
MainWindow object<br>2- in its __init__ it instantiates many
QtGui.QTableView objects<br>3- in their __init__ they instantiate one
QtSql.QSqlQueryModel object each<br>=> If I pass through all this
chain a reference to the mainWindow object (as init parameter) and I
use it just in the subsequent. init-functions, every thing works
fine.<br>=> If I store this reference in a queryModel object
attribute, for subsequent. uses, every thing LOOKS LIKE it's
functioning correctly, I don't get any error, but at the end of the
execution all sqlite modifications are NOT written to disk and I find
a db-journal file near by my db file. Note that it's enough that I
store the reference to the mainWindow object, it doesn't matter if I
don't or do use it.<br>I was able to bypass this problem using a
weakref.ref(mainW) instead of a plain reference<br><br>Does this make
any sense to you or it is a bug?<br><br>I hope to receive a followup
to my question even if I didn't to the previous ones (perhaps my
English is too bad and no one can understand it ???)</p><p style="margin-bottom: 0cm;"><br></p><p style="margin-bottom: 0cm;">ciao</p><p style="margin-bottom: 0cm;">Licia<br></p>
</div>