wxURL DefaultProxy Access violation

Maximilian Matthé Maxi.Matthe at web.de
Tue Sep 18 10:45:50 PDT 2007


Hello!

I tried to get support in the IRC-Channel, but nobody could help me, so 
I try it here.
I am using win2k with wxmsw-2.8.5 and vcexpress 2005.

I have a problem with wxURL::SetDefaultProxy. It works (I can use the 
proxy and I can send requests to it), but when I exit the application, I 
get an access violation in the file free.c. The call stack comes from 
GSocket::~GSocket GSocket.cpp line 198 and then gsockmsw.cpp line 337.
The problem occurs only, if I use a wxurl to get something from the 
internet.

here are the important lines:

wxURL::SetDefaultProxy("65.111.168.207:3128");
wxURL url("http://noticket.no.funpic.de/license/check.php?key=abcd");
wxInputStream* from = url.GetInputStream();

I hope you can tell me what m doing wrong or if this is a bug.
I have compiled it unter linux width gtk-2.8.4 and everything works fine.

This is my test program:

///////////////////////////////////////
#include <wx/wx.h>
#include <wx/url.h>
#include <wx/txtstrm.h>

// Access violation when the app exits. If I have not clicked on the frame,
// thus not getting a file from the internet, no access violation.
// the accessviolation appears in GSocket::~GSocket.

class frame : public wxFrame
{
public:
	frame() : wxFrame(NULL, wxID_ANY, "Proxytest", wxDefaultPosition, 
wxDefaultSize)
	{
		wxURL::SetDefaultProxy("65.111.168.207:3128");
		Show();
	}

	void OnMouse(wxMouseEvent& e)
	{
		// Read file from the internet by clicking on the frame
		wxURL url("http://noticket.no.funpic.de/license/check.php?key=abcd");
		wxInputStream* from = url.GetInputStream();
		if(from)
		{
			wxTextInputStream in(*from);
			std::string text;
			while(from->CanRead())
				text += in.ReadLine().ToAscii();
			wxMessageBox(text);
		}
		else
			wxMessageBox("Error");
		delete from;

	}	

	DECLARE_EVENT_TABLE()
};

BEGIN_EVENT_TABLE(frame, wxFrame)
	EVT_LEFT_DOWN(frame::OnMouse)
END_EVENT_TABLE()

class app : public wxApp
{
public:
     virtual bool OnInit()
     {
		new frame();
		return true;
     }
};
IMPLEMENT_APP(app)
///////////////////////////////////





More information about the wx-users mailing list