Recent

Author Topic: OwnPaint Paint Program: Help to Fix the Access Violation Errors  (Read 477 times)

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
OwnPaint Paint Program: Help to Fix the Access Violation Errors
« on: February 23, 2024, 03:54:11 pm »
I was tinkering with the source code to OwnPaint from https://github.com/TereshchenkoOleg/OwnPaint
and sorted out a few of the bugs, but I cannot seem to get rid of the access violation error.

I get the error when trying to change properties of all the shapes and also when clicking on the rounded rectangle icon initially.

I can get the color, line width, fill style, fill color to change but only after pressing OK to ignore the error.


Graphics gurus badly needed for much needed help on this one.
« Last Edit: February 24, 2024, 12:24:41 am by Boleeman »

VisualLab

  • Sr. Member
  • ****
  • Posts: 332
Re: OwnPaint Paint Program: Help to Fix the Access Violation Errors
« Reply #1 on: February 23, 2024, 04:23:51 pm »
I was tinkering with the source code to OwnPaint from https://github.com/voleksa/OwnPaint
and sorted out a few of the bugs, but I cannot seem to get rid of the access violation error.

I get the error when trying to change properties of all the shapes and also when clicking on the rounded rectangle icon initially.

I can get the color, line width, fill style, fill color to change but only after pressing OK to ignore the error.


Graphics gurus badly needed for much needed help on this one.

The problem seems to be calls to a procedure called "Invalidate_".  In the entire project, there is only one place where there is an instruction to check whether this pointer is empty. Elsewhere it is simply called without checking.

I did a little test using the debugger:

1. I compiled and ran the program,
2. I drew a rectangle in black (default),
3. I displayed the fill color change dialog for this rectangle,
4. an error message window appeared.

While tracing, when the color of the rectangle changes, the "TBrushColorParam.ChangeBrushColor(Sender: TObject)" procedure is called. While tracing the code contained in it, I receive information from the debugger that the pointer to the called procedure "Invalidate_" is empty.
« Last Edit: February 23, 2024, 04:28:30 pm by VisualLab »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: OwnPaint Paint Program: Help to Fix the Access Violation Errors
« Reply #2 on: February 24, 2024, 12:17:30 am »
Yes VisualLab, that was it. Invalidating was the problem.

My problem was that there was no line number to go to when I had the Access Violation fault, just some address leading me round in circles.

Success at last.

Many thanks VisualLab.
« Last Edit: February 24, 2024, 12:20:29 am by Boleeman »

 

TinyPortal © 2005-2018