Hello,<br><br>I&#39;m displaying a TreeStore in a TreeView and I want to refresh them when I receive the gobject signal &quot;refresh&quot;.<br><br>Because my refresh can be heavy and I don&#39;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(&quot;refresh&quot;,self.do_refresh)<br><br>do_refresh()<br>&nbsp;&nbsp;&nbsp; thread(self.general_refresh)<br><br>general_refresh()<br>&nbsp;&nbsp;&nbsp; if self.lock.acquire(False) :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; refresh_treestore()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.lock.release()<br>
<br>refresh_treestore() :<br>At first, I was emptying the TreeStore then added the elements but I&#39;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)&#39;
failed<br>
&nbsp; gtk.main()<br>
/home/ploum/code/gtg/taskbrowser/browser.py:180: Warning: g_object_set_property: assertion `G_IS_VALUE (value)&#39; failed<br>
&nbsp; gtk.main()<br>
/home/ploum/code/gtg/taskbrowser/browser.py:180: Warning: g_value_unset: assertion `G_IS_VALUE (value)&#39; failed<br>
&nbsp; gtk.main()<br><br>The crash can happen at start, it can happen after 10 minutes, it&#39;s completely random. Also, the crash always happens after the lock is released.<br><br>I&#39;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&#39;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&nbsp; (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>