|
From: Matt K. <ra...@ch...> - 2004-03-30 20:33:12
|
Dave,
The actual bug, as it turns out, is with the compiler!!!
I'm using gcc/g++ 3.3, which apparently has a problem with
global class object constructors. What is happening is that
wxGTK has some global native data type variables that get initialized
to a specific value; it also has global class objects, the most problematic
being wxString class objects.
The problem is that the compiler generates code that causes
the global class objects to get constructed before at least some
of the native data type global variables get initialized. The
wxString class uses an initialized global variable in its
constructor. But sadly, the global var is not yet initialized,
and is NULL at the time the global wxString objects' constructors
are called. Since the global wxString objects never get set to anything
during JAZZ/Audacity operation, this NULL value within the global
wxString objects causes the crash on exit/destruction.
The fixable code is in the wxString destructor, which is in
<top source dir>/include/wx/string.h for versions 2.4.x and below, and in
the wxStringBase destructor, same file, in 2.5.x.
This destructor is a one liner. Here's the quick fix, shown for version
2.4.2. The 2.5.x fix is the same, but is in the ever-so-slightly-different
wxStringBase destructor:
IS:
...
~wxString() { GetStringData()->Unlock(); }
...
CHANGE TO:
~wxString() { if (m_pchData) GetStringData()->Unlock(); }
Of course, the "more correct" fix is to change compilers. Ack.
Dave -- if you wouldn't mind, could you post this to Audacity-devel? I'm
not a member of that group. The responder on the wxWidget team didn't
seem too thrilled about making this fix -- he said to change compilers.
Maybe having more "pressure" to apply this "fix" will change their minds.
Matt
>
> Matt,
>
> I forwarded this email to Audacity-devel because it's affecting them, too.
> Would you be able to point to a file, line, or possible a viewcvs link to the
> broken code? Or just tell me where to look and I'll dig it up. :)
>
> I don't think cross-posting will work here, unless you guys are all members of
> the audacity-devel list (which would make cross-pointing almost pointless
> anyway), because I think it's a subscriber-only list now.
>
> Thanks,
>
> Dave
>
> On Monday 29 March 2004 07:47 pm, Matt Kelly wrote:
> > OK, I've found the problem. It's a wxGTK bug, in the wxString
> > class.
> >
> > The default constructor initializes a pointer data member (the member that
> > holds the actual storage) to NULL. The destructor blindly
> > dereferences this pointer. If the string never gets set to anything,
> > it dereferences a NULL pointer minus an index, making for a truly
> > horrible pointer value.
> >
|