Yes, as it says at the top of type-handlers.cpp, we have to clean up many uses of cleanup() in the marshallers. <br><br>Thanks,<br>Michael<br><br><div class="gmail_quote">On Fri, Nov 20, 2009 at 10:21 AM, Justin Talbot <span dir="ltr"><<a href="mailto:justintalbot@gmail.com">justintalbot@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Works for me.<br>
<br>
This change takes out the checks in marshal_QString and<br>
marshal_QByteArray that were causing my crash. Is this safe to do now?<br>
<br>
Index: qtbase/src/type-handlers.cpp<br>
===================================================================<br>
--- qtbase/src/type-handlers.cpp (revision 200)<br>
+++ qtbase/src/type-handlers.cpp (working copy)<br>
@@ -449,7 +449,7 @@<br>
} else {<br>
m->setSexp(qstring2sexp(*s));<br>
}<br>
- if(m->cleanup() || m->type().isStack() ) {<br>
+ if(m->cleanup()) {<br>
delete s;<br>
}<br>
} else {<br>
@@ -505,7 +505,7 @@<br>
} else {<br>
m->setSexp(rstringFromQByteArray(s));<br>
}<br>
- if(m->cleanup() || m->type().isStack() ) {<br>
+ if(m->cleanup()) {<br>
delete s;<br>
}<br>
} else {<br>
<div><div></div><div class="h5"><br>
<br>
On Fri, Nov 20, 2009 at 7:18 AM, Michael Lawrence <<a href="mailto:lawremi@gmail.com">lawremi@gmail.com</a>> wrote:<br>
> This bug should now be fixed. Let me know if it works for you, Deepayan.<br>
><br>
> On Thu, Nov 19, 2009 at 10:01 AM, Michael Lawrence <<a href="mailto:lawremi@gmail.com">lawremi@gmail.com</a>><br>
> wrote:<br>
>><br>
>><br>
>> On Thu, Nov 19, 2009 at 9:22 AM, Justin Talbot <<a href="mailto:justintalbot@gmail.com">justintalbot@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> On Thu, Nov 19, 2009 at 8:54 AM, Michael Lawrence <<a href="mailto:lawremi@gmail.com">lawremi@gmail.com</a>><br>
>>> wrote:<br>
>>> ><br>
>>> ><br>
>>> > On Thu, Nov 19, 2009 at 4:15 AM, Deepayan Sarkar<br>
>>> > <<a href="mailto:deepayan.sarkar@gmail.com">deepayan.sarkar@gmail.com</a>><br>
>>> > wrote:<br>
>>> >><br>
>>> >> On Wed, Nov 18, 2009 at 2:49 PM, Deepayan Sarkar<br>
>>> >> <<a href="mailto:deepayan.sarkar@gmail.com">deepayan.sarkar@gmail.com</a>> wrote:<br>
>>> >> > On Wed, Nov 18, 2009 at 1:46 PM, Deepayan Sarkar<br>
>>> >> > <<a href="mailto:deepayan.sarkar@gmail.com">deepayan.sarkar@gmail.com</a>> wrote:<br>
>>> >> >> Any idea what's going wrong here?<br>
>>> >> >><br>
>>> >> >> ### Just code:<br>
>>> >> >><br>
>>> >> >> library(qtbase)<br>
>>> >> >><br>
>>> >> >> gscene <- Qt$QGraphicsScene()<br>
>>> >> >> rtxt <- gscene$addText("some text")<br>
>>> >> >> rtxt<br>
>>> >> >> (rtxt$toPlainText()) ## fine<br>
>>> >> ><br>
>>> >> > And as a confirmation that the <QList> thing is not a problem, I<br>
>>> >> > get:<br>
>>> >> ><br>
>>> >> >> item0 <- gscene$itemAt(0, 0)<br>
>>> >> >> item0<br>
>>> >> > <environment: 0x9e21428><br>
>>> >> > attr(,"class")<br>
>>> >> > [1] "QGraphicsTextItem" "QObject" "QGraphicsItem"<br>
>>> >> > [4] "UserDefinedDatabase" "environment"<br>
>>> >> >> item0$toPlainText()<br>
>>> >> ><br>
>>> >> > *** caught segfault ***<br>
>>> >><br>
>>> >> Other QGraphicsItem-s seem fine, so it must be the multiple<br>
>>> >> inheritance (QObject+QGraphicsItem) problem of QGraphicsTextItem<br>
>>> >> again. Given that rtxt works but item0 doesn't, maybe it's a coercion<br>
>>> >> problem somewhere in the wrapping stage?<br>
>>> >><br>
>>> ><br>
>>> > Everything method invocation fails with item0. The weird thing is that<br>
>>> > the<br>
>>> > environments are different. Every C++ pointer should have the same<br>
>>> > environment, and this holds true for the other QGraphicsItem types.<br>
>>> > This<br>
>>> > indicates that the pointer being returned by itemAt() and items() is<br>
>>> > incorrect.<br>
>>> ><br>
>>> > Just checked it, and it looks like the pointer retrieved by e.g.<br>
>>> > itemAt()<br>
>>> > points 8 bytes higher than the one from addText(). This happens at the<br>
>>> > Smoke<br>
>>> > level, but looking at their wrappers reveals nothing. Yes, they are<br>
>>> > casting<br>
>>> > to different types, (QGraphicsTextItem *) vs (QGraphicsItem *), but<br>
>>> > that<br>
>>> > shouldn't change the value of the pointer, should it? The same error<br>
>>> > happens<br>
>>> > for addWidget() and its QGraphicsProxyWidget return value. So yes it<br>
>>> > seems<br>
>>> > like a multiple inheritance issue, but I don't understand how a simple<br>
>>> > cast<br>
>>> > could cause this. Maybe it's just another C++ surprise?<br>
>>> ><br>
>>> >><br>
>>> >> -Deepayan<br>
>>> >> _______________________________________________<br>
>>> >> Qtinterfaces-devel mailing list<br>
>>> >> <a href="mailto:Qtinterfaces-devel@lists.r-forge.r-project.org">Qtinterfaces-devel@lists.r-forge.r-project.org</a><br>
>>> >><br>
>>> >><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>
>>> ><br>
>>> > _______________________________________________<br>
>>> > Qtinterfaces-devel mailing list<br>
>>> > <a href="mailto:Qtinterfaces-devel@lists.r-forge.r-project.org">Qtinterfaces-devel@lists.r-forge.r-project.org</a><br>
>>> ><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>
>>> ><br>
>>><br>
>>> I haven't looked at this problem, but casting can change the pointer's<br>
>>> value in C++ when there's multiple inheritance. This is due to C++'s<br>
>>> virtual function table mechanism for inheritance. For more info see<br>
>>> section 4.4 of <a href="http://www-plan.cs.colorado.edu/diwan/class-papers/mi.pdf" target="_blank">http://www-plan.cs.colorado.edu/diwan/class-papers/mi.pdf</a><br>
>>><br>
>><br>
>> Alrighty then. Right now, we're using the introspection information of the<br>
>> QGraphicsItem to resolve the class from the QGraphicsItem returned by<br>
>> itemAt() down to QGraphicsTextItem (so that we can use methods like<br>
>> toPlainText()). But the pointer is still of QGraphicsItem type, so must be<br>
>> cast appropriately via smoke->cast(). I'll fix this tonight.<br>
>><br>
>>><br>
>>> Justin<br>
>><br>
><br>
><br>
</div></div></blockquote></div><br>