[Kwintv] crash in QtVision::SetChannel
Rizsanyi Zsolt
kwintv@mail.kde.org
Fri, 25 Oct 2002 22:55:52 +0200
Hi!
As you maybe already know, there is a bug in QtVision::SetChannel causing a
crash sometimes.
A backtrace showed the line 505 in qtvision.cpp to have caused the crash. And
indeed:
void QtVision::setChannel( Channel *channel )
{
if (!channel)
return;
//kdDebug() << "QtVision::setChannel()" << endl;
····
if (_chan)
_prevChannel = _chan->number (); // line 505
It assumes, that if _chan is not NULL then it is a valid pointer. Which is not
a valid assumption, since the channels are deleted by ChannelStore (and in my
case they were deleted by openChannelFile)
I see some possible solutions to this:
1) remove this previous channel thing - it is only used for dcop if I
understand it correctly, and I dont see for what it is good for
2) do a copy of the channel when setting _chan (meaning 'if (_chan) delete
_chan; _chan = new Channel(channel)' instead of '_chan = channel' ). Of
course in that case we should take care to delete the Channel objects where
_chan points to when assigning a new value
It can also cause some problems when checking channel equality, since we now
have two different objects
3) take care to do '_chan = NULL' when the channel store is deleted (or that
exact channel is deleted) -- this may be impossible
I vote for solution 1)
What do you vote for? :)
Regards
Zsolt