Bug 8054 – assert(0) doesn't fire when called by C code, but triggers in debugger
Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-05-06T12:10:00Z
Last change time
2012-06-17T12:32:18Z
Assigned to
nobody
Creator
wfunction
Comments
Comment #0 by wfunction — 2012-05-06T12:10:02Z
I don't have a test case for this yet (the code is huge, and I'd have to trim a lot of Win32 window code to get this), but basically how it goes is this:
If you subclass a window by changing its WNDPROC in Windows, and then assert(0) inside the WNDPROC, it doesn't always get propagated back; however, if a debugger is attached, it is always detected.
Funny thing is, *sometimes* it /does/ get propagated back -- it happened when I used SendMessage() /before/ my assertion. But when I omitted it, I didn't get any errors.
The same exact issue happens when I say asm { int 3; } -- it just jumps out of the method, but the code continues fine outside of the C callback (SendMessage). And yet if the debugger is attached, it fires.
(I don't have any catch() blocks in my code.)
I'll try to produce a test case for it when I get the chance (hopefully I'll remember by then...) but that's the issue right now.