FIX: You may receive an access violation error message when you use ios-derived types

This article has been archived. It is offered "as is" and will no longer be updated.
SYMPTOMS
If you create and destroy ios-derived classes in multiple threads, you may receive an access violation error message. This problem occurs only if you use the earlier iostream library instead of the Standard C++ Library that was introduced with Microsoft Visual C++ 5.0.

You can gain access to the earlier iostream library by including iostream header files that have the .h file name extension, such as the iostream.h file or the strstream.h file. The new header files do not have a file name extension, such as the iostream file or the strstream file.
CAUSE
The ios::fLockcInit static member is used to hold reference counts for a critical section that is used in the multithreaded C run-time library. This critical section reference provides synchronization for the ios class. The ios::fLockcInit static member is changed without synchronization when you create and destroy ios-derived classes. This scenario allows a race condition. The critical section reference count that the ios::fLockcInit static member holds may be destroyed more than one time or may be used after it is destroyed.
RESOLUTION

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft Visual Studio .NET. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
837234 List of bugs that are fixed in Visual Studio .NET 2002 Service Pack 1

Hotfix information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version     Size     File name   -----------------------------------------------------   29-Jan-2004  21:44  7.0.9760.0   54,784  Msvci70.dll   29-Jan-2004  20:40  7.0.9760.0   94,208  Msvci70d.dll   29-Jan-2004  20:31              506,486  Libcimt.lib   29-Jan-2004  20:38              492,406  Libcimtd.lib   29-Jan-2004  19:41                6,569  _ios.cpp
WORKAROUND
To work around this problem, use the Standard C++ Library instead of the earlier iostream library. For example, use
#include <iostream>
instead of the following code.
#include <iostream.h>
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article. This problem was first corrected in Visual Studio .NET 2002 Service Pack 1.
MORE INFORMATION
For more information about the terminology that is used to describe Microsoft product updates, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Properties

Article ID: 834740 - Last Review: 10/26/2013 20:37:27 - Revision: 2.1

  • Microsoft Visual C++ .NET 2002 Standard Edition
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • kbnosurvey kbarchive kberrmsg kbbug kbfix kbqfe kbvsnetpresp1fix kbvs2002sp1sweep kbvs2002sp1fix kbhotfixserver KB834740
Feedback