[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-dev] Problem with checksumstream in 0.9.1
From: |
David White |
Subject: |
[Wesnoth-dev] Problem with checksumstream in 0.9.1 |
Date: |
Sun, 01 May 2005 16:19:09 -0500 |
User-agent: |
Mozilla Thunderbird 0.8 (Windows/20040913) |
In Wesnoth 0.9.1, checksumstream is derived from
std::basic_ostream<char>, and has a checksumstreambuf sbuf; as a member,
where checksumstreambuf is derived from std::basic_streambuf<char>
Its constructor looks like this:
checksumstream::checksumstream() : std::basic_ostream<char>(&sbuf)
{
}
This is a problem because bases are constructed before members. So, at
the time the std::basic_ostream<char> constructor is run, sbuf hasn't
been constructed, and std::basic_ostream<char> is given an address to an
invalid object.
This causes a crash in VC++6 with STLPort.
I am hacking around this so I can make a working Windows release of
0.9.1 by defining checksumstream like this:
class checksumstream : private checksumstreambuf, public
std::basic_ostream<char>
{
public:
checksumstream();
unsigned long checksum();
private:
checksumstreambuf& sbuf;
};
and its constructor like this:
checksumstream::checksumstream() : std::basic_ostream<char>(this),
sbuf(*this)
{
}
However it would be appreciated if the person who wrote this class apply
a permanent fix.
David
- [Wesnoth-dev] Problem with checksumstream in 0.9.1,
David White <=