Alright, I think it's fixed in svn. Was deleting the QStandardItem, even though Qt owned it (in the model). Unfortunately, Qt has fairly ad-hoc memory ownership policies compared to GTK+. <br><br>Also, in this simple case, you might find cb$insertItem(i-1, letters[i]) to be easier than explicitly creating the QStandardItem.<br>
<br>At some point we will need vectorized functions for populating data models like rGtkDataFrame.<br><br>Michael<br><br><div class="gmail_quote">On Wed, Apr 14, 2010 at 9:48 AM, Michael Lawrence <span dir="ltr"><<a href="mailto:michafla@gene.com">michafla@gene.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br><br><div class="gmail_quote"><div class="im">On Wed, Apr 14, 2010 at 7:41 AM, John Verzani <span dir="ltr"><<a href="mailto:verzani@math.csi.cuny.edu" target="_blank">verzani@math.csi.cuny.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I am having trouble consistently getting a combobox to behave properly. In particular, with this test case I rarely get past 40 before the process dies. Am I setting up the combobox completely wrong? (I've tried using setItemText but that failed as well and I don't think my issue is having so many widgets open.)<br>
<br><br clear="all">library(qtbase)<br><br>testit <- function(i) {<br> cb <- Qt$QComboBox()<br> mod <- cb$model()<br> <br> ## set values<br> sapply(seq_along(letters), function(i) {<br> item <- Qt$QStandardItem(letters[i])<br>
mod$setItem(i-1, item)<br> })<br> <br> cb$setCurrentIndex(2)<br> cat(i, cb$model()$item(2)$text(), "\n")<br>}<br><br><br>## <br>for(i in 1:1000) {<br> out <- try(testit(i), silent=TRUE)<br> if(inherits(out, "try-error")) {<br>
print(i)<br> stop(i)<br> }<br>}<br><br>## eventually dies but not consistently, e.g:<br>...<br>8 c <br>[1] 9<br>Error in eval.with.vis(expr, envir, enclos) : <br> Error in cat(i, cb$model()$item(2)$text(), "\n") : <br>
attempt to apply non-function<br><br>(Basically what happens is all items in the model are set to NULL, so the call to the text method fails.)<br><br></blockquote></div><div><br>Yea it looks like corruption somewhere. No idea where though, will have to look into it.<br>
<br>Thanks,<br>Michael<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"><br>> sessionInfo()<br>R version 2.10.1 (2009-12-14) <br>
i486-pc-linux-gnu <br>
<br>locale:<br>[1] en_US.UTF-8<br><br>attached base packages:<br>[1] stats graphics grDevices utils datasets methods base <br><br>other attached packages:<br>[1] qtbase_0.6-2<br><font color="#888888"><br>
-- <br>John Verzani<br>
Chair, Department of Mathematics<br>College of Staten Island, CUNY<br><a href="mailto:verzani@math.csi.cuny.edu" target="_blank">verzani@math.csi.cuny.edu</a><br>
</font><br></div>_______________________________________________<br>
Qtinterfaces-devel mailing list<br>
<a href="mailto:Qtinterfaces-devel@lists.r-forge.r-project.org" target="_blank">Qtinterfaces-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel</a><br>
<br></blockquote></div><br>
</blockquote></div><br>