Recent

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

Eugene Loza

  • Hero Member
  • *****
  • Posts: 656
    • My games in Pascal
[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 »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Almir.Bispo

  • Jr. Member
  • **
  • Posts: 91
  • 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

  • Jr. Member
  • **
  • Posts: 70
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.
Windows 10 Home, Lazarus 2.02 (svn 60954), FPC 3.04

SunyD

  • Guest
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.

wp

  • Hero Member
  • *****
  • Posts: 11830
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

howardpc

  • Hero Member
  • *****
  • Posts: 4144
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: 1228
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
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • 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 »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

guest58172

  • Guest
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.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • 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 »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018