|
From: Brett B. <br...@in...> - 2003-02-25 04:31:16
|
Summary of what I am asking/observed:
Forgive me if I don't remember C++ very well. But is it bad to have the
variable name the same name as a variable passed to the method. In PHP I
think it would just reassign it but I wasn't sure that was okay in C++.
void MainWindowImpl::showPopup(QListViewItem *item, const QPoint& p , int i) {
if (item) {
KMonListViewItem* item = dynamic_cast<KMonListViewItem*>(item);
item->showPopup(p);
}
}
I changed it to this and it seems to be working better:
void MainWindowImpl::showPopup(QListViewItem *item, const QPoint& p , int i) {
if (item) {
KMonListViewItem* myitem = dynamic_cast<KMonListViewItem*>(item);
myitem->showPopup(p);
}
}
It still wont work but seems to be crashing somewhere else now.
When I changed the name of the KMonListViewItem* from item to myitem (line
numbers 189,190) in mainwindowimpl.cpp I was able to prevent crashes at the
_node->showPopupMenu( p ) in kmonnotifierlistviewitem.cpp But now I get them
at KMonNode::showPopupMenu (QPoint const&) on kmonnode.cpp:144. (see
backtrace) Is it really getting futher?
[New Thread 1024 (LWP 13193)]
0x41131909 in wait4 () from /lib/libc.so.6
#0 0x41131909 in wait4 () from /lib/libc.so.6
#1 0x411b59e4 in __DTOR_END__ () from /lib/libc.so.6
#2 0x410630b3 in waitpid () from /lib/libpthread.so.0
#3 0x406a748e in KCrash::defaultCrashHandler(int) ()
from /usr/kde/3.1/lib/libkdecore.so.4
#4 0x41060e1b in pthread_sighandler () from /lib/libpthread.so.0
#5 <signal handler called>
#6 0x40bf3076 in QMenuData::clear() () from /usr/qt/3/lib/libqt-mt.so.3
#7 0x08055794 in KMonNode::showPopupMenu(QPoint const&) (this=0x8115d10,
p=@0xfffffe00) at kmonnode.cpp:144
#8 0x080543e9 in KMonListViewItem::showPopup(QPoint const&) (this=0xfffffe00,
p=@0xfffffe00) at kmonnotifierlistviewitem.cpp:36
So I thought I would comment out the _popupMenu->clear(); just to see where it
would get me. (line 144 in KMonNode)
[New Thread 1024 (LWP 15595)]
0x41131909 in wait4 () from /lib/libc.so.6
#0 0x41131909 in wait4 () from /lib/libc.so.6
#1 0x411b59e4 in __DTOR_END__ () from /lib/libc.so.6
#2 0x410630b3 in waitpid () from /lib/libpthread.so.0
#3 0x406a748e in KCrash::defaultCrashHandler(int) ()
from /usr/kde/3.1/lib/libkdecore.so.4
#4 0x41060e1b in pthread_sighandler () from /lib/libpthread.so.0
#5 <signal handler called>
#6 0x40bf25f8 in QMenuData::insertAny(QString const*, QPixmap const*,
QPopupMenu*, QIconSet const*, int, int, QWidget*, QCustomMenuItem*) ()
from /usr/qt/3/lib/libqt-mt.so.3
#7 0x40bf2792 in QMenuData::insertItem(QString const&, QObject const*, char
const*, QKeySequence const&, int, int) () from /usr/qt/3/lib/libqt-mt.so.3
#8 0x080557f5 in KMonNode::showPopupMenu(QPoint const&) (this=0x8116c70,
p=@0xfffffe00) at kmonnode.cpp:147
#9 0x080543e9 in KMonListViewItem::showPopup(QPoint const&) (this=0xfffffe00,
p=@0xfffffe00) at kmonnotifierlistviewitem.cpp:36
It just got me to the next line it uses _popupMenu
Patrik, I CC'd you just incase the mailing list still wont let me send.
|