![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Optimisation causing crash I have the following C++ // unmanaged code func() { // this class is principly data CMyClass Obj(); do { CallManagedWrapper(&Obj); } while(...) // crashes second time around } // manage code CallManagedWrapper( CMyClass* pObj) { CMyManagedClass^ ManObj = gcnew CMyManagedClass(pObj); } CMyManagedClass(CMyClass* pObj) { // copy data from unmanaged code m_dbA = pObj->m_dbA; } With optimisation off around func() there is no crash with it on, the second time the CMyManagedClass construtor accesses pObj it crashed. so. #pragma optimize("", off) // unmanaged code func() { // this class is principly data CMyClass Obj(); do { CallManagedWrapper(&Obj); } while(...) // crashes second time around } #pragma optimize("", on) there is no problem also there is no problem if I do this: // unmanaged code func() { // this class is principly data CMyClass* pObj = new CMyClass(); CMyClass& Obj = *pObj; do { CallManagedWrapper(&Obj); } while(...) // crashes second time around delete pObj; } I am worried that this problem may occur elsewhere so am seeking an understanding of the problem. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| WMDC Causing PFN List Corrupt crash? | Vista General | |||
| RICOH Camera Drivers Causing Crash | Vista hardware & devices | |||
| Vista (or ??) causing Internet to crash | Vista General | |||
| XPS viewer causing vista display to crash... | Vista General | |||
| Media Center Causing Crash in VistaB2 | Vista General | |||