Recent

Author Topic: Can't change anything on a form  (Read 5390 times)

adriane

  • New member
  • *
  • Posts: 6
Can't change anything on a form
« on: January 10, 2016, 10:08:36 pm »
Got a project and if I alter an element on the form in any way I get a division by 0 in the .lfm
All I tried doing was changing the design time position of a memo box. Compiled no problem. Tried to run from Windows (not in the IDE) and got divide by zero in .lfm
Put everything back as it was (by restoring the backed up lfm form) and it compiles and runs.
Altered again and this time run from within the IDE. Got a divide by zero!
Restored the backup and all fine again.
Next I tried to alter the font in a drop down. Compiled. Come out of Lazarus. Went back in and got a divide by zero error on the form.
Restored the backup again. Compiled and it runs within and out of the IDE and everything is good.
Version 1.4.4 Free Pascal 2.6.4 Windows 10
I suspect it is something amiss with Windows 10 but I can't work out what the issue is.
I'm at the point where trying the same things and expecting different outcomes is a sign of madness!



Bart

  • Hero Member
  • *****
  • Posts: 3480
    • Bart en Mariska's Webstek
Re: Can't change anything on a form
« Reply #1 on: January 11, 2016, 01:03:35 am »
Can you try with 1.6RC1 ?

Bart

wp

  • Hero Member
  • *****
  • Posts: 6149
Re: Can't change anything on a form
« Reply #2 on: January 11, 2016, 01:36:26 am »
Can you try to simplify the project, i.e. remove non-standard controls, dependence on other forms etc., while keeping the bug and then upload the project here? (only lfm, pas, lpi and lpr files packed into a single zip)

Are there any non-standard components compiled into your lazarus? Sometimes strange behavior originates in third-party components. Uninstall them one by one and see whether the bug goes away after removing one particular component.

Moreover, turn off you anti-virus program for a test. We've seen here a lot of strange issues caused by the antivirus going crazy by self-made programs.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

adriane

  • New member
  • *
  • Posts: 6
Re: Can't change anything on a form
« Reply #3 on: January 11, 2016, 09:48:57 am »
1. Will try 1.6 first. I'm pretty much convinced this is a Windows 10 issue.
2. I'm going to see if it still happens on Linux as well.
3. I'm also going to put the changes in the code so they occur at run-time. It does seem to be a form error.

adriane

  • New member
  • *
  • Posts: 6
Re: Can't change anything on a form
« Reply #4 on: January 11, 2016, 10:27:10 am »
1.6rc1 didn't sort it out.
As an experiment I changed the size/posn of the Memo component that I wanted to move by editing the .lfm using Notepad.
Went back in to Lazarus. Compiled and run. So that worked.

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: Can't change anything on a form
« Reply #5 on: January 11, 2016, 12:38:16 pm »
Open lazarus, change the form contents to create the problem save and then upload here both the old and new lfm file or search them for differences your self pay close attention to numeric values and your settings of decimal separator and thousand grouping digits.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

bylaardt

  • Sr. Member
  • ****
  • Posts: 303
Re: Can't change anything on a form
« Reply #6 on: January 11, 2016, 05:17:58 pm »
i had a similar issue on linux.
was fixed saving the lfm file in utf8 format.

adriane

  • New member
  • *
  • Posts: 6
Re: Can't change anything on a form
« Reply #7 on: January 11, 2016, 08:16:05 pm »
I did try on Ubuntu, FP3 installed easily, but Lazarus was a bummer to install.

Program compiled and no problems at and everything works as expected on Linux.

Got plenty of suggestions to work with so I'll give them all a go and get back with a happy conclusion, I hope.

Cheers for now.

adriane

  • New member
  • *
  • Posts: 6
Re: Can't change anything on a form
« Reply #8 on: January 12, 2016, 10:56:03 am »
Tracked down the culprit but still not solved on Windows 10.

Project raised exception class 'External: SIGPE'
In file Lplproc.pas at Line 902
which is :   if (length(Msg) div (length(Msg) div 10000))=0 then ;

That isn't the error but the divide by zero exception (that isn't see below code copied from unit) gets triggered in my program running Windows 10 whereas Linux does not.

{------------------------------------------------------------------------------
  procedure RaiseGDBException(const Msg: string);

  Raises an exception.
  Normally gdb does not catch fpc Exception objects, therefore this procedure
  raises a standard "division by zero" exception which is catched by gdb.
  This allows one to stop a program, without extra gdb configuration.
 ------------------------------------------------------------------------------}

procedure RaiseGDBException(const Msg: string);
begin
  debugln(rsERRORInLCL, Msg);
  // creates an exception, that gdb catches:
  debugln(rsCreatingGdbCatchableError);
  DumpStack;
  if (length(Msg) div (length(Msg) div 10000))=0 then ;
end;

User137

  • Hero Member
  • *****
  • Posts: 1790
    • Nxpascal home
Re: Can't change anything on a form
« Reply #9 on: January 12, 2016, 11:40:37 am »
You need to trace further what calls the RaiseGDBException().

Bart

  • Hero Member
  • *****
  • Posts: 3480
    • Bart en Mariska's Webstek
Re: Can't change anything on a form
« Reply #10 on: January 12, 2016, 06:21:09 pm »
Run the crashing executable from within gdb, let it crash, then get a backtrace (make sure the app is compiled with debug info).
See: http://wiki.lazarus.freepascal.org/Creating_a_Backtrace_with_GDB

The backtrace will tell from where RaiseGDBException was called.

Bart

adriane

  • New member
  • *
  • Posts: 6
Re: Can't change anything on a form
« Reply #11 on: January 18, 2016, 07:09:03 pm »
Thanks people. I cheated and found myself a windows 8 machine. Compiled fine on that and works fine on Windows 10 once compiled.When I get a bit more time I'll try and work out what was going on.