[fpc-devel] threads vs widestringmanager / crash
Martin Frb
lazarus at mfriebe.de
Wed Dec 21 12:59:07 CET 2022
On 21/12/2022 11:37, Marc Weustink via fpc-devel wrote:
>
>
> On 20-12-2022 21:12, Sven Barth via fpc-devel wrote:
>> So the only logical solution is to stop the offending thread from
>> executing or not to have it call InitThread() while the
>> initialization section of the System unit is still running. The
>> former might have unintended consequences (e.g. not being able to
>> debug the unit initialization) while the later might work in most
>> cases as long as that remote thread doesn't need to execute code that
>> relies on InitThread().
>
> The latter may be the best solution. Skip any rtl call when a thread
> attaches during initialization. In normal cases this will only be
> triggered when a debugger attaches. It usually only forces a
> breakpoint, so no fully initialized rtl is needed.
Ondrey
When you got the issue, did you:
- Use FpDebug?
- Lazarus 2.3
- Run/Debug - But *not* press the "pause" button?
Because if so, the debugger should not have sent any DebugBreak.
Unless Windows itself injects threads, if an exe is started with
"poDebugProcess".
So maybe something else is injecting threads... And the reason it
happens (to be observed) only in the debugger is that the timing changes.
Ondrey, if the above (FpDebug, not pressed "pause") applies, can you
test the following:
Modify the system unit, and in the "initialization" section, insert some
"sleep(250);" between statements (downto after InitSystemThreads)
Then run without debugger.
More information about the fpc-devel
mailing list