[kde-solaris] Crash in kmail (kdepim-3.1.93)

Eva Brucherseifer eva at kde.org
Mon Nov 24 13:27:44 CET 2003


On Montag, 24. November 2003 12:53, James F. Hranicky wrote:
> On Mon, 24 Nov 2003 02:22:34 -0400
>
> Stefan Teleman <steleman at nyc.rr.com> wrote:
> > Should _never_ use C-style casts, but dynamic_cast<>(), and check for
> > returning 0.

You are casting "this" and  this should never be 0 - strange thing.

>
> When I try changing the line to this:
>
>     const QListViewItem* c = dynamic_cast<QListViewItem * const>(this);


const QListViewItem* const c = dynamic_cast<QListViewItem * const>(this);

or 

const QListViewItem* const c = this;

should work. The pointer and the object are both const. 

Still casting away the const shouldn't give any seg faults. I'd expect the 
problem to be something else. This is only intuition though, since I don't 
know the code.

Greetings,
eva

>
> I get this compilation error:
>
>    widgets/qlistview.cpp:3815: error: cannot dynamic_cast `this' (of type
> `const class QListViewItem* const') to type `class QListViewItem* const' (
> conversion casts away constness)
>
> Do you know how this should be done? My C++ is *very* rusty.
>
> Jim
>
> > On Sunday 23 November 2003 22:21, James F.Hranicky wrote:
> > > Platform: Solaris 8
> > > Compiler: gcc/g++ 3.3.2 -g (debug enabled for qt and kde)
> > > IMAP Server: courier 1.6.2/freebsd
> > >
> > > When running kmail, I can read some of my folders without any
> > > problems, but when I go to read my INBOX, and kmail is retrieving
> > > the header list, I get a sefgault (shortened gdb output):
> > >
> > >   Program received signal SIGSEGV, Segmentation fault.
> > >   0xfc9535cc in QListViewItem::listView() const (this=0x33be70)
> > >       at widgets/qlistview.cpp:3815
> > >   (gdb) where
> > >   #0  0xfc9535cc in QListViewItem::listView() const (this=0x33be70)
> > >       at widgets/qlistview.cpp:3815
> > >   #1  0xff065a90 in KMHeaderItem::irefresh() (this=0x33be70) at
> > > kmheaders.cpp:207 #2  0xfedf2dcc in
> > > KMHeaders::msgHeaderChanged(KMFolder*, int) (this=0x33be70,
> > > msgId=996088) at kmheaders.cpp:1363
> > >   (gdb) p this
> > >   $1 = (const QListViewItem * const) 0x33be70
> > >   (gdb) p c
> > >   $2 = (const QListViewItem *) 0x6c626f78
> > >   (gdb) p *c
> > >   Cannot access memory at address 0x6c626f78
> > >   (gdb)
> > >
> > >   ----:**-F1  *gud-kmail*
> > > (Debugger:run)--L235--Bot-----------------------------------
> > >
> > >   QListView * QListViewItem::listView() const
> > >   {
> > >       const QListViewItem* c = this;
> > >   =>  while ( c && !c->is_root )
> > >           c = c->parentItem;
> > >       if ( !c )
> > >           return 0;
> > >       return ((QListViewPrivate::Root*)c)->theListView();
> > >   }
> > >
> > > Other times, c is a different invalid value:
> > >
> > >   [Switching to Thread 1 (LWP 1)]
> > >   0xfbc1d34c in _poll () from /usr/lib/libc.so.1
> > >   (gdb) c
> > >   Continuing.
> > >
> > >   Program received signal SIGSEGV, Segmentation fault.
> > >   0xfc9535cc in QListViewItem::listView() const (this=0x570da8)
> > >     at widgets/qlistview.cpp:3815
> > >   (gdb) p this
> > >   $1 = (const QListViewItem * const) 0x570da8
> > >   (gdb) p c
> > >   $2 = (const QListViewItem *) 0x149
> > >   (gdb)
> > >
> > > The cast seems to have problems, I guess due to a pointer bug
> > > somewhere. Anyone have any suggestions?
> > >
> > > -------------------------------------------------------------------
> > >---
> > >
> > > | Jim Hranicky, Senior SysAdmin                   UF/CISE
> > > | Department | E314D CSE Building                            Phone
> > > | (352) 392-1499 | jfh at cise.ufl.edu
> > > | http://www.cise.ufl.edu/~jfh |
> > >
> > > -------------------------------------------------------------------
> > >--- ___________________________________________________
> > > This message is from the kde-solaris mailing list.
> > > Account management:
> > > https://mail.kde.org/mailman/listinfo/kde-solaris. Archives:
> > > http://lists.kde.org/.
> > > More info: http://www.kde.org/faq.html.
> >
> > --
> > Stefan Teleman          'Nobody Expects the Spanish Inquisition'
> > steleman at nyc.rr.com                          -Monty Python
> >
> > ___________________________________________________
> > This message is from the kde-solaris mailing list.
> > Account management:  https://mail.kde.org/mailman/listinfo/kde-solaris.
> > Archives: http://lists.kde.org/.
> > More info: http://www.kde.org/faq.html.
>
> ___________________________________________________
> This message is from the kde-solaris mailing list.
> Account management:  https://mail.kde.org/mailman/listinfo/kde-solaris.
> Archives: http://lists.kde.org/.
> More info: http://www.kde.org/faq.html.



More information about the kde-solaris mailing list