List:MySQL++« Previous MessageNext Message »
From:Adam Nielsen Date:October 15 2009 3:24am
Subject:mysqlpp::Connection copy c'tor segfaults
View as plain text  
Hi all,

I'm trying to open a new connection to a MySQL database by duplicating an
existing connection (as the docs[1] seem to indicate this is an acceptable
method) however it causes my application to segfault.

Here is a short example that reproduces the problem:

#include <mysql++.h>

int main(void)
{
        mysqlpp::Connection main;
        main.connect("db", "host", "user", "pass");
        mysqlpp::Connection copy(main);
        return 0;
}

(gdb) bt
#0  0x00007fa739228735 in free () from /lib/libc.so.6
#1  0x00007fa739cece27 in mysql_options (mysql=0x13feba8, option=<value
optimized out>, arg=0x13e85a8 "my") at client.c:3013
#2  0x00007fa73a03a863 in mysqlpp::ReadDefaultFileOption::set () from
/usr/lib/libmysqlpp.so.3
#3  0x00007fa73a035ca0 in mysqlpp::DBDriver::set_option () from
/usr/lib/libmysqlpp.so.3
#4  0x00007fa73a036773 in mysqlpp::DBDriver::connect () from
/usr/lib/libmysqlpp.so.3
#5  0x00007fa73a03690f in mysqlpp::DBDriver::DBDriver () from
/usr/lib/libmysqlpp.so.3
#6  0x00007fa73a0302c3 in mysqlpp::Connection::Connection () from
/usr/lib/libmysqlpp.so.3
#7  0x0000000000400ac4 in main () at test.cpp:7

What am I doing wrong??

Many thanks,
Adam.

[1]
http://tangentsoft.net/mysql++/doc/html/refman/classmysqlpp_1_1Connection.html#a2
Thread
mysqlpp::Connection copy c'tor segfaultsAdam Nielsen15 Oct
  • Re: mysqlpp::Connection copy c'tor segfaultsWarren Young15 Oct
    • Re: mysqlpp::Connection copy c'tor segfaultsJonathan Wakely15 Oct
      • Re: mysqlpp::Connection copy c'tor segfaultsWarren Young15 Oct
        • Re: mysqlpp::Connection copy c'tor segfaultsJonathan Wakely15 Oct