wxWidgets 中 wxIPV4address addr; 引发异常的原因
很多问题,一定是要放在特定环境才能出现的。比如,有如下代码
void * QueryInfoSocketThread::Entry() { wxIPV4address addr; if(!addr.Service(ListenPort)) return NULL; wxSocketServer* pServerSocket = new wxSocketServer(addr);
wxIPV4address addr; 这句代码竟然可以引发异常!不可思议哦!
引发的异常如下图:
这真的是很奇怪,很快发现问题不是我一个:
http://trac.wxwidgets.org/ticket/3010
那个人n年前就举报了........(⊙_⊙)
后来维护人员忍不住了!
After reading the whole discussion I don't understand what needs to be done here. AFAICS the only problem is that Initialize() must be called from the main
thread but it doesn't seem to be a big limitation, is it?
你们不知道在主线程开始前要 Initialize 吗~~~~~~
猪啊啊啊啊啊啊啊~~~~~
于是:
QueryInfoServer::QueryInfoServer() { wxSocketBase::Initialize(); _pQuerySocketThread = new QueryInfoSocketThread( ); SetListenPort(1111); }
解决了~~~~
真是弱智问题嗷嗷