* * *

Author Topic: [BUG] Access Violation on invalid Align value  (Read 947 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 506
    • My "almost daily" development blog
[BUG] Access Violation on invalid Align value
« on: September 08, 2017, 06:08:42 pm »
Access Violation error on inputting an invalid Align value.

Steps to reproduce the bug:
1. Start a fresh Application.
2. Switch to Form Editor.
3. Put any control on the form (I've tested for TButton and TGroupBox)
4. Edit Align and delete a symbol there (e.g. alCustom -> lCustom)
5. Push Enter.
6. Get Access Violation Error
the Lazarus cannot work properly further, showing Access Violation every time something is edited at the Form Editor.

Lazarus 1.8.0RC3 FPC 3.0.3 Debian Jessie 64 bit.
« Last Edit: September 09, 2017, 10:46:46 am by Eugene Loza »
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Almir.Bispo

  • Jr. Member
  • **
  • Posts: 57
  • CSV Comp DB is the Best NoSQL
    • CSV Comp DB (NoSQL)
Re: [BUG] Access Violation on invalid Align value
« Reply #1 on: September 08, 2017, 08:42:01 pm »
This is not a bug,but a bad use.Don't put a empty value because is not permited
CSV Comp DB Developer {Pascal Lover}

Noodly

  • New member
  • *
  • Posts: 42
Re: [BUG] Access Violation on invalid Align value
« Reply #2 on: September 08, 2017, 08:57:19 pm »
@Almir.Bispo

Any program that crashes for any reason has a bug - except O/S or hardware failure.

All programs should cater for any input or sequence of events without crashing and at the very worst show an accurate error message before gracefully exiting.

Soner A.

  • Full Member
  • ***
  • Posts: 193
    • My Blog
Re: [BUG] Access Violation on invalid Align value
« Reply #3 on: September 08, 2017, 09:35:16 pm »
I can't confirm that with Lazarus 1.6.4 and 1.8 RC 4 on windows 7.
When I write wrong value i.e. lcustom or blabla it changes to alCustom.
Maybe Linux or gtk problem.
I use latest Lazarus version with fixes-svn, fpc latest official, Windows 7, All 32Bit

wp

  • Hero Member
  • *****
  • Posts: 3889
Re: [BUG] Access Violation on invalid Align value
« Reply #4 on: September 08, 2017, 11:37:49 pm »
I can't confirm that with Lazarus 1.6.4 and 1.8 RC 4 on windows 7.
When I write wrong value i.e. lcustom or blabla it changes to alCustom.
Maybe Linux or gtk problem.
Same behavior (i.e., no error) on Linux Mint 18.1 KDE 32-bit / Laz trunk / fpc 3.02
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

howardpc

  • Hero Member
  • *****
  • Posts: 2389
Re: [BUG] Access Violation on invalid Align value
« Reply #5 on: September 08, 2017, 11:51:47 pm »
Seems to be a gtk 64-bit-related bug. Happens for me 'reliably' with Mint 18 64-bit.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 651
Re: [BUG] Access Violation on invalid Align value
« Reply #6 on: September 09, 2017, 12:31:13 am »
hello,
on LUBUNTU 16.04  64 bits gtk2 Lazarus 1.8RC3, the first time i try to put a wrong align property i have a small error dialog window with the message access violation but no crash and after to have validate this dialog window no more error.

Friendly, J.P

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3185
  • I like bugs.
Re: [BUG] Access Violation on invalid Align value
« Reply #7 on: September 10, 2017, 12:13:30 pm »
Any program that crashes for any reason has a bug - except O/S or hardware failure.
True, such unhandled Access Violation is always a bug.
It was reproducible. It did not depend on widgetset nor OS nor CPU architecture. Only setting all debug compiler flags for building Lazarus IDE affected. Then more likely an exception was raised instead of doing something unpredictable later.

I fixed it in r55831 in trunk. Please test. If there are no negative side-effects, it will be merged to 1.8.
Interestingly my fix actually reverts r185 by Marco from 2001-02-19, which had message:
 "* Fix from maillist."
The "exit" is needed in TEnumPropertyEditor.SetValue when an invalid value is given.
Maybe it was commented out because the Combobox in OI was then read-only and valid values only could be selected.(?)
I don't think Marco remembers the details either, it has been over 16.5 years...
« Last Edit: September 10, 2017, 03:40:50 pm by JuhaManninen »

BBasile

  • Sr. Member
  • ****
  • Posts: 328
Re: [BUG] Access Violation on invalid Align value
« Reply #8 on: September 10, 2017, 02:51:41 pm »
Access Violation error on inputting an invalid Align value.

Steps to reproduce the bug:
1. Start a fresh Application.
2. Switch to Form Editor.
3. Put any control on the form (I've tested for TButton and TGroupBox)
4. Edit Align and delete a symbol there (e.g. alCustom -> lCustom)
5. Push Enter.
6. Get Access Violation Error
the Lazarus cannot work properly further, showing Access Violation every time something is edited at the Form Editor.

Lazarus 1.8.0RC3 FPC 3.0.3 Debian Jessie 64 bit.

Before creating a duplicated entry, this is the bug:

https://bugs.freepascal.org/view.php?id=29240

It's actually a more generic problem related to TI controls.

____

A workaround is to use a setter that verifies the value when you publish an enum property. (must be >= low(Stuff) and <= high(Stuff)). Unfortunately this only possible for custom components and other persistents.
« Last Edit: September 10, 2017, 02:55:00 pm by BBasile »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3185
  • I like bugs.
Re: [BUG] Access Violation on invalid Align value
« Reply #9 on: September 10, 2017, 08:35:59 pm »
r55831 will be merged to 1.8.
In r55832 I changed the logic so that OI shows '(Invalid)' instead of the old restored value when an invalid enum value is typed.
What do you think?
« Last Edit: September 10, 2017, 11:13:26 pm by JuhaManninen »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus