[RQt-devel] regressions
Michael Lawrence
lawrence.michael at gene.com
Sun Feb 28 20:17:52 CET 2010
On Fri, Feb 26, 2010 at 9:35 PM, Deepayan Sarkar
<deepayan.sarkar at gmail.com>wrote:
> This used to work before:
>
> > qfile <- Qt$QFile("/tmp/foo.R")
> > stream <- Qt$QTextStream(qfile)
> Error in qinvokeStatic(cl, name, ...) :
> Unable to disambiguate method QTextStream::QTextStream
>
> but no longer. A workaround is
>
> > stream <- Qt$QTextStream()
> > stream$setDevice(qfile)
>
> Similarly,
>
> > Qt$QPen(Qt$QColor())
> Error in qinvokeStatic(cl, name, ...) :
> Unable to disambiguate method QPen::QPen
>
> Any idea what might be going on?
>
>
> Even worse, segfaults with
>
> > stream$string()
>
> *** caught segfault ***
> address 0x8, cause 'memory not mapped'
>
> Traceback:
> 1: .Call(qt_qinvoke, x, method, FALSE, list(...))
> 2: qinvoke(<environment>, "string", ...)
> 3: stream$string()
>
>
> and with
>
> > foo <- "foobar"
> > stream <- Qt$QTextStream(foo)
>
> *** caught segfault ***
> address 0x8, cause 'memory not mapped'
>
> Traceback:
> 1: .Call(qt_qinvokeStatic, x, method, list(...))
> 2: qinvokeStatic(cl, name, ...)
> 3: Qt$QTextStream(foo)
>
> (But I guess this usage doesn't make sense for us.)
>
>
I've fixed most of these issues. stream$string() returns NULL, as I think it
should here. Calling setString() or using the constructor above is going to
be a problem. It wants a QString pointer, so it that it can make changes,
which means we need to allocate a new QString on the heap. Normally, when we
see a pointer like that, we (usually correctly) assume that it is a
return-by-reference parameter. Allocating on the heap would be a special
case, and a difficult one at that, since we would need to free the memory
upon destruction of QTextStream.
And you're right that it does not make a lot of sense to write into a
persistent string like that. Better to use QBuffer as the QIODevice.
Thus, I need to tweak the argument scoring code so that the const
QByteArray& constructor is chosen when given a character vector (creating a
read-only stream).
You can check the svn logs to see what I changed. There were 2 main problems
here. The first was that the argument scoring of classes was broken. We need
to score arguments in methods that are overloaded, in certain cases. There
is an attempt to mimic the behavior of the compiler. This is all done via
the scoreArg function template. The second problem was that I had forgotten
to handle the 'QString*' type. Smoke is configured so that QString is
treated as a "void pointer" type, instead of a class, because most language
bindings want to convert QString to a native string type. The other voidps
are things like primitive pointers and template types (e.g. QList). All of
these voidp's need to be handled special-cased via the typeHandlers hash.
Michael
-Deepayan
> _______________________________________________
> Qtinterfaces-devel mailing list
> Qtinterfaces-devel at lists.r-forge.r-project.org
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20100228/79942fe4/attachment.htm
More information about the Qtinterfaces-devel
mailing list