[Solved] One exe crashes another

Everything else that doesn't fall into one of the other PB categories.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

[Solved] One exe crashes another

Post 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?
Last edited by Dude on Fri Feb 10, 2017 5:03 am, edited 1 time in total.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: One exe crashes another

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: One exe crashes another

Post 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> :)
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: One exe crashes another

Post 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! :)
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: [Solved] One exe crashes another

Post by Keya »

damn those handles huh? ;)
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: [Solved] One exe crashes another

Post 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:
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: [Solved] One exe crashes another

Post 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.
User avatar
TI-994A
Addict
Addict
Posts: 2770
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: [Solved] One exe crashes another

Post by TI-994A »

Dude wrote:...endless and tricky logic puzzles! :lol:
You mean debugging. :lol:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Post Reply