Crash in ExtractIconEx

Hello,

I have been seeing a strange issue recently where my application crashes during a call to ExtractIconEx(). The weird thing is that this call succeeds the first 10 times or so, but then all of a sudden my application crashes, even though there is an exception handler around the call.

Does anybody know what could be causing a problem like this?

Thanks!
Just a guess since you haven't really provided any detail, but are you loading your icons multiple times without deleting them? This sounds like a memory horizon event.
Not as far as I can see.

In my constructor I have this:

ExtractIconEx(_T("shell32.dll"), 17, NULL, &myIcon, 1);

And then in my destructor this:

1
2
3
if (myIcon != NULL) {
  DestroyIcon(myIcon);
}
Last edited on
Well then, I've shot my wad. Without more code, it will be impossible to know why you are (apparently) leaking memory.

EDIT: Without knowing more, you may need to loop through DestroyIcon() multiple times if you are extracting more than one icon. I don't know this for sure, but it may be a similar situation as when you are deletinging[] a NEW pointer.
Last edited on
Topic archived. No new replies allowed.