Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Given an address of "4", Likely the "this" pointer is null or the iterator is bad. You should be able to see this in the debugger. If this is null, then the problem isn't in that function but who ever is calling that function. If the iterator is bad, then it's the race condition you alluded to. Most iterators can't tolerate the list being updated.</p> <p>Okay wait - No FM here. Static's are initialized on first use. The code that does this is not multi-thread safe. one thread is doing the initialization while the 2nd thinks it's already been done but it's still in progress. The result is that is uses an uninitialized variable. You can see this in the assembly below:</p> <pre><code>static x y; 004113ED mov eax,dword ptr [$S1 (418164h)] 004113F2 and eax,1 004113F5 jne wmain+6Ch (41141Ch) 004113F7 mov eax,dword ptr [$S1 (418164h)] 004113FC or eax,1 004113FF mov dword ptr [$S1 (418164h)],eax 00411404 mov dword ptr [ebp-4],0 0041140B mov ecx,offset y (418160h) 00411410 call x::x (4111A4h) 00411415 mov dword ptr [ebp-4],0FFFFFFFFh </code></pre> <p>The $S1 is set to 1 when it init's. If set, (004113F5) it jumps over the init code - freezing the threads in the fnc won't help because this check is done on entry to a function. This isn't null, but one of the members is.</p> <p>Fix by moving the map out of the method and into the class as static. Then it will initialize on startup. Otherwise, you have to put a CR around the calls do DoStuff(). You can protect from the remaining MT issues by placing a CR around the use of the map itself (e.g. where DoStuff uses operator[]).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload