Hello,<br><br>I'm displaying a TreeStore in a TreeView and I want to refresh them when I receive the gobject signal "refresh".<br><br>Because my refresh can be heavy and I don't want to refresh 10 times when not needed, the refresh is handled in a thread. The principle is the following :<br>
<br>SignalEmitter.connect("refresh",self.do_refresh)<br><br>do_refresh()<br> thread(self.general_refresh)<br><br>general_refresh()<br> if self.lock.acquire(False) :<br> refresh_treestore()<br> self.lock.release()<br>
<br>refresh_treestore() :<br>At first, I was emptying the TreeStore then added the elements but I've seen somewhere on the web that it might be better to create a new TreeStore then to set_model on the TreeView<br><br>
<br>Unfortunatly, it crashes randomly with the error :<br>
<br>
/home/ploum/code/gtg/taskbrowser/browser.py:180: GtkWarning:
gtk_tree_store_get_value: assertion `VALID_ITER (iter, tree_store)'
failed<br>
gtk.main()<br>
/home/ploum/code/gtg/taskbrowser/browser.py:180: Warning: g_object_set_property: assertion `G_IS_VALUE (value)' failed<br>
gtk.main()<br>
/home/ploum/code/gtg/taskbrowser/browser.py:180: Warning: g_value_unset: assertion `G_IS_VALUE (value)' failed<br>
gtk.main()<br><br>The crash can happen at start, it can happen after 10 minutes, it's completely random. Also, the crash always happens after the lock is released.<br><br>I've no idea why it crashes like this and any help would be greatly appreciated !<br>
<br><br>If you are motivated enough to try the real code, I've put a bzr branch on <a href="https://code.edge.launchpad.net/~gtg/gtg/threaded">https://code.edge.launchpad.net/~gtg/gtg/threaded</a>. simply do :<br><br>
<tt>bzr branch lp:~gtg/gtg/threaded</tt><br>
<br>The code is in taskbrowser/browser.py (refresh_treestore is called refresh_ts).<br><br>(and if you want to see the application in its normal shape, just do bzr branch lp:gtg )<br><br>Thanks a lot for your (future) help,<br>
<br>Lionel<br>