Open GoogleCodeExporter opened 9 years ago
原因是:CDelegate(O* pObj, Fn pFn) : CDelegateBase(pObj, &pFn), m_pFn(pFn) { } 中的 &pFn,对于同一个方法,取得只是指向这个方法的地址,但是� ��个地址可能每次都不一样, 这就造成每次赋值给CDelegateBase::m_pFn的值都不一样 修改方法: CDelegate(O* pObj, Fn pFn) : CDelegateBase(pObj, ((void*)(*(int *)&(pFn)))), m_pFn(pFn) { } 赋值给CDelegateBase::m_pFn的值就是方法指针本身,这个就能保证 同一个方法,传进来的值都是一样的
Original issue reported on code.google.com by pro...@gmail.com on 18 Feb 2014 at 8:32
pro...@gmail.com
[deleted comment]
使用uintptr_t代替int,应该更适合跨平台兼容
Original comment by pro...@gmail.com on 18 Feb 2014 at 8:50
Original issue reported on code.google.com by
pro...@gmail.com
on 18 Feb 2014 at 8:32