WPTools 7 - Access Violation in component destruction

  • Our software uses WPTools version 7.21 and we have been using it for a while. Recently I am getting crash reports from users caused by an Access Violation in the function TWPCustomRtfEdit.Notification. The stack trace shows it is entirely in Windows or WPTools code following a form close operation. Is there a known issue, and if so would upgrading the version solve the problem?

  • There is a newer version of WPTools 7 than WPTools version 7.21. I recommend to use the latest.


    Of course it would be best to get the upgrade to WPTools 8.


    In case you use threading please make sure to create a WPTools environment for each thread. See the threading demo.

  • I recommend to use the latest WPTools 9.2 since WPTools 7 is retired since 2017. It also compiles with Delphi 5, with some limitation in the UTF8 area,


    The AV may be a double free of an object anywhere in the project. You can check by using FastMem.


    If the destructor makes problems you can add code to the Form.OnClose to free components manually:


    acomponent.Parent := nil;

    acomponent.Free;


    Then you hopefully get more information in the debugger.

  • Hi Julian,


    Here's a print out from the Madshi bug report. Maybe this is sufficient. If not, I'll try manual freeing as suggested and see what that outputs.


    callstack crc : $4e13e0b8, $6ead7e03, $afdc3cb4

    exception number : 1

    exception class : EAccessViolation

    exception message : Access violation at address 0085E62A in module 'Will_Writer.exe'. Read of address 090B4214.


    thread $484:

    0085e62a +05e Will_Writer.exe WPCTRMemo 13830 +12 TWPCustomRtfEdit.Notification

    00883792 +09e Will_Writer.exe WPCTRRich 4781 +11 TWPCustomRichText.Notification

    0047a2ec +04c Will_Writer.exe Classes TComponent.Notification

    00497173 +00f Will_Writer.exe Controls TControl.Notification

    004aff5c +010 Will_Writer.exe Forms TCustomForm.Notification

    0047a1b1 +01d Will_Writer.exe Classes TComponent.RemoveComponent

    0047a021 +061 Will_Writer.exe Classes TComponent.Destroy

    00496f04 +0a0 Will_Writer.exe Controls TControl.Destroy

    00499f57 +0bb Will_Writer.exe Controls TWinControl.Destroy

    0049f955 +01d Will_Writer.exe Controls TCustomControl.Destroy

    008516a0 +184 Will_Writer.exe WPCTRMemo 6356 +38 TWPCustomRtfEdit.Destroy

    00880bf3 +097 Will_Writer.exe WPCTRRich 3607 +17 TWPCustomRichText.Destroy

    00499f27 +08b Will_Writer.exe Controls TWinControl.Destroy

    004ca609 +039 Will_Writer.exe ComCtrls TTabSheet.Destroy

    00499f27 +08b Will_Writer.exe Controls TWinControl.Destroy

    004c996e +03e Will_Writer.exe ComCtrls TCustomTabControl.Destroy

    004caa11 +049 Will_Writer.exe ComCtrls TPageControl.Destroy

    00499f27 +08b Will_Writer.exe Controls TWinControl.Destroy

    004af154 +028 Will_Writer.exe Forms TScrollingWinControl.Destroy

    004afe03 +0ab Will_Writer.exe Forms TCustomForm.Destroy

    00403324 +008 Will_Writer.exe System TObject.Free

    004b36e0 +000 Will_Writer.exe Forms TCustomForm.CMRelease

    00498d75 +111 Will_Writer.exe Controls TControl.WndProc

    0049b906 +1d2 Will_Writer.exe Controls TWinControl.WndProc

    004b0c62 +3aa Will_Writer.exe Forms TCustomForm.WndProc

    0049b508 +02c Will_Writer.exe Controls TWinControl.MainWndProc

    004ae1a0 +014 Will_Writer.exe Forms StdWndProc

    779aa56b +00b user32.dll DispatchMessageA

    004b69af +083 Will_Writer.exe Forms TApplication.ProcessMessage

    004b69e6 +00a Will_Writer.exe Forms TApplication.HandleMessage

    004b6bf1 +081 Will_Writer.exe Forms TApplication.Run

    00d8d5e7 +03b Will_Writer.exe Will_Writer 93 +3 initialization

    77b4fa27 +017 KERNEL32.DLL BaseThreadInitThunk


    thread $46a8 (TWorkerThread):

    774711a3 +93 KERNELBASE.dll WaitForSingleObjectEx

    774710fd +0d KERNELBASE.dll WaitForSingleObject

    00533f13 +17 Will_Writer.exe VirtualTrees 5065 +3 TWorkerThread.Execute

    00462233 +2b Will_Writer.exe madExcept HookedTThreadExecute

    00479d58 +1c Will_Writer.exe Classes ThreadProc

    00404104 +28 Will_Writer.exe System ThreadWrapper

    00462115 +0d Will_Writer.exe madExcept CallThreadProcSafe

    0046217f +37 Will_Writer.exe madExcept ThreadExceptFrame

    77b4fa27 +17 KERNEL32.DLL BaseThreadInitThunk

    >> created by thread $484 at:

    00533e42 +16 Will_Writer.exe VirtualTrees 5028 +1 TWorkerThread.Create


    thread $480:

    7747b24d +fd KERNELBASE.dll WaitForMultipleObjectsEx

    00462115 +0d Will_Writer.exe madExcept CallThreadProcSafe

    0046217f +37 Will_Writer.exe madExcept ThreadExceptFrame

    77b4fa27 +17 KERNEL32.DLL BaseThreadInitThunk

    >> created by thread $484 at:

    77763fb7 +00 combase.dll


    thread $3c98:

    77b4fa27 +17 KERNEL32.DLL BaseThreadInitThunk


    thread $3390:

    77b4fa27 +17 KERNEL32.DLL BaseThreadInitThunk


    thread $41c0:

    77b4fa27 +17 KERNEL32.DLL BaseThreadInitThunk


    thread $2fb8:

    77b4fa27 +17 KERNEL32.DLL BaseThreadInitThunk


    thread $3640:

    77b4fa27 +17 KERNEL32.DLL BaseThreadInitThunk

  • wpsupport

    Changed the title of the thread from “Access Violation in component destruction” to “WPTools 7 - Access Violation in component destruction”.