Re: [Dev-C++] segmentation fault at runtime
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Alfred P. R. <al...@ya...> - 2004-12-15 21:06:28
|
Hi Black Eagle,
It could be that you are returning the address of m_pSrv rather than it's contents. You've declared m_pSrv as a pointer to a KviIrcServer class. However, in server(), you return m_pSrv, rather than it's contents *m_pSrv. server() is declared as returning a pointer to the class, which is the value of m_pSrv, not it's address.
Hope that makes sense!
Black Eagle <bla...@ea...> wrote:
Hi guys!
I got a problem at run time, when using a pointer in a function.
The error is in the function KviIrcServer* server() at line : return m_pSrv;
In all other functions I got no problem with this variable. It is another
class that tries to call this function, it's the friendclass beChannel
<snip>
class KviIrcServer;
<snip>
KviIrcServer* server();
<snip>
private :
KviIrcServer * m_pSrv;
<snip>
KviIrcServer* beConsole::server()
{
qDebug("returning server");
return m_pSrv;
}
<snip>
Alfred P. Reaud
|