Issues with wxString: wxMac and wxMSW 2.6.3

Anthony T. goumba2k5-groups-delafterdashgroups at yahoo.com
Mon Sep 4 10:42:05 PDT 2006


Hi,

I'm having a problem using wxString. Consider the following:

class AnyFrame : public wxFrame {
	wxString	str_debug;	// Private member

	public:
		AnyFrame();
		void doSomething();
};

AnyFrame::AnyFrame() : wxFrame(...), str_debug("") { } // Have also 
tried str_debug("empty")

void doSomething() {
	str_debug = "Test";
}

A call to doSomething causes the program to crash under Mac and Windows 
(other OSes not tested).

Under Mac, wxWindows was built using DialogBlocks 3.06 ANSI and the 
Xcode project included in the tarball.

On Windows, wxWindows was built using the included Visual Studio project.

Xcode's debugger states "GDB: Program received signal: 'EXC_BAD_ACCESS'."

Visual Studio gives me an unhandled exception, "Access violation".

Both point to this line in wx/string.h

   // accessor to string data
   wxStringData* GetStringData() const { return (wxStringData*)m_pchData 
- 1; }

I've searched and found nothing regarding this version (although some 
posts regarding previous versions of wx with no solution), so I figure 
its something I'm doing wrong, so based on the above code, what *am* I 
doing wrong?

TIA,
Anthony






More information about the wx-users mailing list