Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, September 2006
VM crash when passing a String where a QVariant is expected


Message 1 in thread

Hi!

I've attached code that crashes the VM on Linux when trying to pass data to 
the QStandardItemModel. It seems that the Qt Jambi code tries to convert the 
Object (in this case a String) to a QVariant in order to pass the data along 
to the native setData() method.

I realise that the code I'm providing is neither very clean nor easy to 
understand. What happens is that a message is passed through the Java logging 
framework and sent to the LoggerViewHandler which should process it in its 
publish() method, but crashes when trying to insert it into the 
QStandardItemModel.

The sample code is attached as an exported Eclipse project and also includes a 
crash log from the Java VM.

The console output of the program is the following:

-- snip --

level: INFO
message: Logging messages will appear here
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  SIGSEGV (0xb) at pc=0xb77b5c46, pid=25629, tid=3084719792
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_08-b03 mixed mode)
# Problematic frame:
# V  [libjvm.so+0x185c46]
#
# An error report file with more information is saved as hs_err_pid25629.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

-- snip --

The output before the crash verifies that the data that is passed is really a 
sane String object.

I'm also not quite sure if what I'm doing is really correct. I find that there 
are two overloaded versions of the setData() method in Java that I do not see 
in the documentation. They take two integers instead of a QModelIndex as 
parameters.

Regards,
Gregor

Attachment:

Attachment: qtbug2.zip
Description: Zip archive


Message 2 in thread

Gregor Mückl wrote:
> Hi!
> 
> I've attached code that crashes the VM on Linux when trying to pass data to 
> the QStandardItemModel. It seems that the Qt Jambi code tries to convert the 
> Object (in this case a String) to a QVariant in order to pass the data along 
> to the native setData() method.
> 
> I realise that the code I'm providing is neither very clean nor easy to 
> understand. What happens is that a message is passed through the Java logging 
> framework and sent to the LoggerViewHandler which should process it in its 
> publish() method, but crashes when trying to insert it into the 
> QStandardItemModel.
> 
> The sample code is attached as an exported Eclipse project and also includes a 
> crash log from the Java VM.
> 
> The console output of the program is the following:


> I'm also not quite sure if what I'm doing is really correct. I find that there 
> are two overloaded versions of the setData() method in Java that I do not see 
> in the documentation. They take two integers instead of a QModelIndex as 
> parameters.

The int overloads are the problem. These where added because they where 
faster when used from Java. There is however something wrong there, so 
it crashes. If you use the overloads that take a QModelIndex the example 
works.

best regards,
Gunnar


Message 3 in thread

On Sunday 24 September 2006 13:09, Gunnar Sletta wrote:
> Gregor Mückl wrote:
> >
> > I'm also not quite sure if what I'm doing is really correct. I find that
> > there are two overloaded versions of the setData() method in Java that I
> > do not see in the documentation. They take two integers instead of a
> > QModelIndex as parameters.
>
> The int overloads are the problem. These where added because they where
> faster when used from Java. There is however something wrong there, so
> it crashes. If you use the overloads that take a QModelIndex the example
> works.
>
> best regards,
> Gunnar

Thank you very much. This works fine now.

Regards,
Gregor