Current filter:
                                You should refresh the page.
                                  • Precondition:
                                    TdxSpellChecker.UseThreadedLoad = True

                                    Description:
                                    If TdxSpellChecker.LoadDictionaries is called while the spell checker is still busy loading dictionaries from a previous call to LoadDictionaries then an Access Violation occurs.

                                    Cause:
                                    TdxCustomSpellChecker.LoadDictionaries calls
                                      TdxCustomSpellChecker.LoadDictionariesUsingThread calls
                                        TdxCustomSpellCheckerDictionary.LoadUsingThread.

                                    TdxCustomSpellCheckerDictionary.LoadUsingThread:

                                    [Delphi]
                                    procedure TdxCustomSpellCheckerDictionary.LoadUsingThread; begin if not CanLoad then Exit; FreeAndNil(FLoadThread); FLoadThread := TdxDictionaryLoadThread.Create(Self); end;

                                    Because FreeAndNil is used, the FLoadThread variable is nilled before the thread is destroyed.

                                    This becomes a problem because the thread OnTerminate handler calls TdxCustomSpellCheckerDictionary.ThreadDone:

                                    [Delphi]
                                    procedure TdxCustomSpellCheckerDictionary.ThreadDone(Sender: TObject); begin if not LoadThread.IsLoadComplete then Cleanup else SpellChecker.CheckCallEnabledDictionariesLoaded; end;

                                    which fails because LoadThread=nil.

                                    Solution:
                                    The solution is to replace the FreeAndNil with:

                                    [Delphi]
                                    FLoadThread.Free; FLoadThread := nil;
                                • Mikhail (DevExpress Support) 09.06.2019

                                  Hello Anders,

                                  Thank you for the information. I will forward this thread to our developers for research.

                                • Mikhail (DevExpress Support) 09.11.2019

                                  Hello Anders,

                                  We tried to replicate the issue, but failed. Would you please provide us with a test project to demonstrate the problem?

                                • Anders Melander 09.11.2019

                                  No.
                                  It's a race condition and as such the problem will only surface when the timing is right. The timing depends on the CPU speed, the number of cores, the system load, the disk speed etc.

                                  I have already provided you with an analysis which clearly pinpoints exactly where the problem occurs and exactly why it occurs. You don't need a test case to see that there is a problem.

                                  FWIW, there's another place in the code where you use Free instead of FreeAndNil to avoid this exact problem. Just search for FreeAndNil.

                                • Mikhail (DevExpress Support) 09.12.2019

                                  As I see the subject of this thread, you mentioned that the Access Violation exception can be raised in our code in some situations.
                                  We tried to make a scenario by your description to replicate this issue, but failed. As we see, our code works correctly. That is why I'm asking you to provide us with a small test example that demonstrates the problem in our sources, i.e. causes the Access Violation exception.

                                0 Solutions

                                Creation Date Importance Sort by