solved

The problem wasn't in this code... I started to follow my pointers (you seemed pretty sure when you said it was a pointer problem, so I assumed you were right and I had this problem somewhere) and the problem was when I created a new formular (QDialog); there, I reinitializate the databe and seems like I had to close it or they had some kind of compatibility problem.

I just send the database pointer trough the constructor, the database is not set up again in the new QDialog, and it works.

thanks!