List:MySQL++« Previous MessageNext Message »
From:mazah_82 Date:June 16 2006 8:17am
Subject:Re: Destructor of the Connection fails
View as plain text  
Hi again,

I simplified things a bit more. Now i have the following code (without 
any Query object):

int main(int argc, char *argv[])
{
  Connection con(use_exceptions);
  con.connect(/*parameters here..*/);
  if(!con.connected())
  {
    cout << "Can't connect!" << endl;
    return 1;
  }
    
  cout << "Closing connection.." << endl;
  con.close();
  cout << "Exiting.." << endl;
  
  return 0;
}

It crashes in the line "con.close()". GDB tells me the following story:

Program received signal SIGSEGV, Segmentation fault.
0x00000039d1068b85 in free () from /lib64/tls/libc.so.6

If I have only the following code, it works fine.

int main(int argc, char *argv[])
{
  Connection con(use_exceptions);
  cout << "Exiting.." << endl;
  return 0;
}

But every time I connect to the database something goes wrong when I am 
closing the connection (or destructing the Connection object).

What should I do?

Regards,

-Matti

 
> Hi,
> 
> I have the following code:
> 
> int main(int argc, char *argv[])
> {
> 	
>   Connection con(use_exceptions);
>   con.connect(/*put parameters here*/);
>   Query query = con.query();
>   
>   cout << "Exiting.." << endl;
>   
>   return 0;
> }
> 
> After "Exiting.." is printed the program causes segmentation fault. I 
> think this means that destructor of either Connection or Query fails. Do 
> I handle objects con and query in improper way or is there a bug in 
> mysql++?
> 
> I have MySQL 5.0.20, mysql++ 2.1.1 and GCC 3.4.5 on Red Hat Linux.
> 
> 
> Regards,
> 
> -Matti
> 

__
Saunalahti Xtra - Uusi GSM-vuokrapuhelin ja edistykselliset Xtra-palvelut
käyttöösi alk. 4,95 e/kk! http://saunalahti.fi/xtra/

Thread
Destructor of the Connection failsmazah_8215 Jun
Re: Destructor of the Connection failsmazah_8216 Jun
  • Re: Destructor of the Connection failsWarren Young17 Jun
Re: Destructor of the Connection failsmazah_8219 Jun
  • Re: Destructor of the Connection failsWarren Young19 Jun