[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Strange backtrace
From: Stefan Majewsky <majewsky () gmx ! net>
Date: 2009-07-28 19:48:08
Message-ID: 200907282148.11756.majewsky () gmx ! net
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Hi,
during my last refactoring, I've introduced some crashes in Kolf 2, which I'm
working through currently. While analysing a backtrace, I stumbled upon
something that puzzled me, and contradicts my understanding of C++. As it
might be that this misunderstanding hinders me from discovering the true
source of the crash, I thought it might be good to ask for help here. Here is
the relevant part of the backtrace:
> Application: Kolf (kolf-ng), signal: Segmentation fault
> [KCrash Handler]
> #6 0x00000000 in ?? ()
> #7 0x0808f277 in Kolf::Game::setCurrentHole (this=0xbfb99b78, newHole=0)
> at /home/smajewsky/Code/kolf/kolf/engine/game.cpp:109
> #8 0x08093a56 in Kolf::NormalGame::startGame (this=0x82097e8)
> at /home/smajewsky/Code/kolf/kolf/engine/game-normal.cpp:77
> #9 0x080966a4 in Kolf::MainWindowPrivate::newGame (this=0x81e50a8)
> at /home/smajewsky/Code/kolf/kolf/intßerface/mainwindow.cpp:87
And here's a code sample from the Kolf::NormalGame class, a subclass of
Kolf::Game: (The full code is in playground/games/kolf-ng/engine.)
bool Kolf::NormalGame::startGame()
{
if (players().count() == 0 || course()->holeCount() <= 0)
return false;
gameUI()->setWindowTitle(course()->title());
//start with first hole and first player
setCurrentHole(0); /* This is line 77 */
return true;
}
As you see, the second-to-last line in the method invokes
Kolf::Game::setCurrentHole, which equals the step from #8 to #7 in above
backtrace. The fact that puzzles me is that the this pointer changes between
#8 and #7. How can I interpret this? In my understanding the this pointer
stays the same even during casts (if we disregard multiple inheritance which
is not used in this class layout). Is this wrong?
Thanks for any help.
Greetings
Stefan
["signature.asc" (application/pgp-signature)]
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic