Results 1 to 1 of 1

Thread: Garbage collector - PyQt

  1. #1
    Join Date
    Dec 2011
    Posts
    4
    Qt products
    Platforms
    Unix/X11

    Default Garbage collector - PyQt

    Hi guys,
    I started using pyqt a few weeks ago, I was not sure about where to but this question but as I'm a newbie here it is.

    I have list, self.cards, that is [QListWidgetItem, string, QString]
    in this function I just iter the elements of this list and populate my QListView (self.cardList).

    Qt Code:
    1. def updateCardList(self):
    2. for card_ in self.cards:
    3. self.cardList.addItem(card_[0])
    To copy to clipboard, switch view to plain text mode 

    It works fine for this function:
    Qt Code:
    1. def selectEditionsF(self):
    2. self.cards=[]
    3. for sEdition in self.selectedEditions:
    4. for edition in self.listEditions:
    5. if sEdition == edition[0]:
    6. for card in edition[1].iter('card'):
    7. self.cards.append([QListWidgetItem(card.get('name')), card.get('graphics'), sEdition])
    8. self.updateCardList()
    9. self.selectEditionsWindow.close()
    To copy to clipboard, switch view to plain text mode 
    but in this case:
    Qt Code:
    1. def refine(self, bool):
    2. tempcards = self.cards
    3. self.cards = []
    4. for card in tempcards:
    5. if self.refineColor.isChecked():
    6. if self.colorBlue.isChecked():
    7. if self.getCardColor(card[0]) == "Blue":
    8. self.cards.append(card)
    9. self.updateCardList()
    To copy to clipboard, switch view to plain text mode 
    When it enters the loop in updateCardList I receive this message: "underlying C/C++ object has been deleted"
    Debug I found that inside the function everything is Ok, the error appears just inside the loop.

    Any Ideas?
    Last edited by janosimas; 11th December 2011 at 13:46.

Similar Threads

  1. Garbage collection
    By Septi in forum Qt Programming
    Replies: 5
    Last Post: 6th July 2010, 14:13
  2. QString, QStringList and garbage collection...
    By PaladinKnight in forum Newbie
    Replies: 4
    Last Post: 5th April 2010, 16:22
  3. qRegisterMetaType: getting garbage through signal/slot
    By zlacelle in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2009, 09:05
  4. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  5. question about garbage collection
    By Dumbledore in forum Qt Programming
    Replies: 4
    Last Post: 18th December 2007, 22:08

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.