stijnsanders / TMongoWire

Delphi MongoDB driver
MIT License
102 stars 37 forks source link

Access Violation XE6 #44

Closed scaleman114 closed 6 years ago

scaleman114 commented 7 years ago

Just trying the latest JSON version of TMongoWire using example1 in XE6. Everytime I try to insert a document I get an access violation. The problem seems to lie in bsonTools.pas - (stack[stackIndex].e:=e;). Hope this helps.

stijnsanders commented 7 years ago

I've had a quick try with Delphi XE7, and I don't get any problem in 32-bits, but do in 64-bits, but not where you say. Have you changed anything? Could you try to first remove all {$D-} and {$L-} from the project, then set a breadkpoint on the line where you get the exception, then run the debugger and when it hits the breakpoint watch the value of stackIndex and stackLength? If stackIndex=-1 then it can cause this error. (It should not get there when stackIndex=-1)

scaleman114 commented 7 years ago

No I haven't changed anything,at that point stackindex=0 and stacklength = 33838368.

stijnsanders commented 7 years ago

That looks like an incorrect stackLength value. I just find out with the Delphi 32-bits compiler, you can count on local values getting a 'zero'-value when a function/procedure starts, with the Delphi 64-bits compiler, this is no longer guaranteed... So for now it looks like I'll have to put a x:=0; at the start of procedures where I expect the local variables to start with zero...

stijnsanders commented 7 years ago

Could you try again with the most recent version of the files?

stijnsanders commented 6 years ago

Haven't heard back, I assume it's solved.