Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::asio::serial_port] Calling cancel() causes Run-Time Check Failure #0 on Visual Studio 2010 SP1
From: Igor R (boost.lists_at_[hidden])
Date: 2012-03-15 10:21:35

> This is a fatal error, there's no way to recover from it, and in release
> builds, a nasty message box appears. It happens when I call
> serial_port::cancel and Boost tries to throw some exception. The exact error
> is:
> Run-Time Check Failure #0 - The value of ESP was not properly saved across a
> function call.  This is usually a result of calling a function declared with
> one calling convention with a function pointer declared with a different
> calling convention.

I couldn't reproduce this crash (Boost 1.49, MSVC10, Win7), maybe
because I don't have any trafic on COM1, but any way -- asio objects
are not thread-safe, so it might be unsafe to call cancel() this way.
Instead, try using the following:[&]
{serialPort.cancel();}); - and see if it helps.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at