Page 1 of 1

[Solved] One exe crashes another

Posted: Fri Feb 10, 2017 4:13 am
by Dude
I've got two standalone executables running, with literally nothing to do with each other: they run from different folders and share nothing.

When the window of one is open, and then I open and close the second one's window, the first exe crashes with an illegal memory access error.

What. The. Hell? :shock: How do I even START to debug this problem?

Re: One exe crashes another

Posted: Fri Feb 10, 2017 4:44 am
by IdeasVacuum
Very tricky.

Sounds as though it may be related to this:
OpenWindow() and PureBasic.exe clash

The symptom is of one app corrupting the memory of the other app. It's rare - if you re-boot your PC, it might not happen again.

Re: One exe crashes another

Posted: Fri Feb 10, 2017 5:01 am
by Keya
Dude wrote:What. The. Hell? :shock: How do I even START to debug this problem?
set your debugger to be Just In Time so that you can break into it when the GPF occurs, and with any luck the stack isn't corrupted and can trace backwards. Sounds like a really fun one to debug though lol </sarcasm> :)

Re: One exe crashes another

Posted: Fri Feb 10, 2017 5:02 am
by Dude
Never mind -- I worked it out. :D Turns out App A was using SetForegroundWindow_() with App B, but apparently App B's window handle was being reported bad (ie. GetForegroundWindow_() for App B was setting the wrong handle). Anyway, when I removed SetForegroundWindow_() in App A, it no longer crashes App B, so I have to fix that situation. Solved! :)

Re: [Solved] One exe crashes another

Posted: Fri Feb 10, 2017 5:03 am
by Keya
damn those handles huh? ;)

Re: [Solved] One exe crashes another

Posted: Fri Feb 10, 2017 5:05 am
by Dude
Yes! :twisted: And it's funny how you forget what you did in one app years ago... I totally forgot it was setting the foreground window of whatever app had the focus at the time. Hence why I thought the two apps had nothing to do with each other, but in reality they were. :?

[Edit] BTW, this is why I love coding -- endless and tricky logic puzzles! :lol:

Re: [Solved] One exe crashes another

Posted: Fri Feb 10, 2017 5:17 am
by Keya
Dude wrote:[Edit] BTW, this is why I love coding -- endless and tricky logic puzzles! :lol:
Yes I think it's a really, really nice aspect of our job as coders that our minds are always being challenged, and not in boring ways (sorry accountants). I wonder what proportion of careers are relatively mundane on the brain? They're the ones being outsource to robots now, but that's another good thing - I can't see robots taking over programmers any time soon. I also like it how our version of 'extreme problems' is a popup window saying an app has crashed, bubblewrapped all the way. There's no way in hell I could be a crane operator! And when it's too hot or too cold outside? No problems! Best job in the world.

Re: [Solved] One exe crashes another

Posted: Fri Feb 10, 2017 8:04 am
by TI-994A
Dude wrote:...endless and tricky logic puzzles! :lol:
You mean debugging. :lol: