Boost logo

Boost Users :

From: peter_foelsche_at_[hidden]
Date: 2008-07-28 16:38:01


I guess you are passing an uninitialized memory location (m_IoService) to the constructor of m_Socket.
I guess m_IoService must be fully constructed before being passed to m_Socket.
Are you aware of the order of construction of base-objects and member-objects and the leave-constructor?

Peter

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Jean-Sebastien Stoezel
Sent: Monday, July 28, 2008 13:17
To: boost-users_at_[hidden]
Subject: [Boost-users] Initialization of boost::asio::ip::tcp::socketgeneates unhandled exception

Hi,

I'm getting confused by the unhandled exception I get when
initializing a TCP socket. This happens when the socket is
instantiated and initialized with an IO service object, from the
constructor of a class called CProcessor.

Here are the variables declaration, inside the class:

boost::asio::ip::tcp::socket m_Socket;
boost::asio::io_service m_IoService;

Here is what the default constructor looks like for this class:
CProcessor::CProcessor(void):
   m_Socket(m_IoService)
{}

The exception is generated by this constructor, as soon as the
m_Socket object is initialized.

The type of unhandled exception I got is as follow:
"Unhandled exception at whatever in hatever.exe: 0xC0000005: Access
violation reading location 0xcccccce0."
The program breaks in win_mutex.hpp, at a line calling:
::EnterCriticalSection(&crit_section_);

I run VS9.

Any idea?!

Thanks,
Jean
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net