|
|
Hi,
I've got a small problem here, which is probably related to the
implicit sharing of QStrings.
Following setup: I have a QMap<QString,QString> and a function that
returns the keys via:
QStringList getKeys(){ return mymap->keys() }
Now the ui uses a qcombobox to display the keys and a qtextedit to
change the data. Altogether the Map holds (Language,Description) pairs
for Images - each Image has it's own map. The ui allows for selecting
another image. Now if all images have no language-description (i.e.
upon creating the whole thing) and I change from image1 to image2,
back to image1 and then again image2 the following code is crashing
(it is executed everytime the selected image changes)
for( QStringList::Iterator it = myimage->getKeys().begin(); it !=
myimage->getKeys().end(); ++it)
{
kdDebug() << (*it) << " = " << myimage->getDescription(*it) << endl;
}
getDescription(QString& lang)
{
if (!lang.isNull() && d->mymap.contains(lang) )
return mymap[lang];
else
return QString();
}
The backtrace for the crash is:
Using host libthread_db library "/lib/tls/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1227132256 (LWP 26061)]
[KCrash handler]
#3 0x0806073a in QString::unicode (this=0x8208c30) at qstring.h:653
#4 0x08060435 in QString::isNull (this=0x8208c30) at qstring.h:874
#5 0x0805ec0d in ImagePrepareImage::description (this=0x82660b8,
lang=@0x8208c30)
at /home/andreas/projects/imageprepare/src/imageprepareimage.cpp:65
#6 0x080575db in ImagePrepareView::slotImageSelected (this=0x8219b38,
item=0x8259a48)
at /home/andreas/projects/imageprepare/src/imageprepareview.cpp:204
#7 0x08057f3b in ImagePrepareView::qt_invoke (this=0x8219b38, _id=46,
_o=0xbfffeb90) at imageprepareview.moc:95
#8 0xb715c5ac in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#9 0xb74c582d in QIconView::currentChanged () from /usr/lib/libqt-mt.so.3
#10 0xb731a71c in QIconViewItem::setSelected () from /usr/lib/libqt-mt.so.3
#11 0xb7322c93 in QIconView::contentsMousePressEventEx ()
from /usr/lib/libqt-mt.so.3
#12 0xb73228a6 in QIconView::contentsMousePressEvent ()
from /usr/lib/libqt-mt.so.3
#13 0xb7ace8c9 in KIconView::contentsMousePressEvent ()
from /usr/lib/libkdeui.so.4
#14 0xb7271ec2 in QScrollView::viewportMousePressEvent ()
from /usr/lib/libqt-mt.so.3
#15 0xb7271825 in QScrollView::eventFilter () from /usr/lib/libqt-mt.so.3
#16 0xb73283ef in QIconView::eventFilter () from /usr/lib/libqt-mt.so.3
#17 0xb7159ede in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#18 0xb7159e0c in QObject::event () from /usr/lib/libqt-mt.so.3
#19 0xb71926af in QWidget::event () from /usr/lib/libqt-mt.so.3
#20 0xb70ffbff in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#21 0xb70ff2f4 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#22 0xb7757e03 in KApplication::notify () from /usr/lib/libkdecore.so.4
#23 0xb7094650 in QETWidget::translateMouseEvent ()
from /usr/lib/libqt-mt.so.3
#24 0xb70922de in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#25 0xb70a91c4 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#26 0xb7111f58 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#27 0xb7111e08 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#28 0xb70ffe51 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#29 0x08052b61 in main (argc=1, argv=0xbffffb14)
at /home/andreas/projects/imageprepare/src/main.cpp:78
the line in ImagePrepareImage is inside the getDescription() method,
the if-Statement (lang.isNull() ), it only happens when I select
image2 for the second time!
Andreas
PS: For those that don't know about kdDebug - it's much like qDebug,
but with cout syntax
--
You will pay for your sins. If you have already paid, please disregard
this message.
--
List archive and information: http://lists.trolltech.com/qt-interest/
--
List archive and information: http://lists.trolltech.com/qt-interest/
|
|