Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

I have been going through my code inducing errors to try and understand what error handling I should be doing.

Please see the "code snippet" at the bottom of this post from c_hellowindow.

If I mess up the parameters in IWindowMgr_CreateWindow....and get the result to be an
error, the IWidget_Release will crash with an access violation reading a null pointer.
If I check for a null pointer and don't do the IWidget_Release I don't get the crash,
but I do see:
LuaContext.cpp:1073 - Invalid element passed to deleteElementLuaContext.cpp:1073 - Invalid element passed to deleteElementEvent

Sometimes this Invalid element is in a infinite loop and keeps scrolling by.

Anybody have any comments?

Thanks a lot,

-Mike

code snippet:

result = IWindowMgr_CreateWindow(pMe->piWindowMgr,
(IQI*) (void *) pWindow->piWindowWidget,
propList, ARR_SIZE(propList), &winId);

//Safe to release this here,
// If successful, the windowing system now holds a reference to the window so
// we need to release our reference to prevent a circular reference/memory
// leak. If it fails we want to release it anyway.
IWidget_Release(pWindow->piWindowWidget);

Not quite sure what you are asking. You should init all pointers to NULL
and you should not release null interface pointers.
You should check return codes for errors as needed. I have seen that LUA
error before (but not on an endless loop - if you can tell me how to
duplicate that please let me know).

Not quite sure what you are asking. You should init all pointers to NULL
and you should not release null interface pointers.
You should check return codes for errors as needed. I have seen that LUA
error before (but not on an endless loop - if you can tell me how to
duplicate that please let me know).