Recent

Author Topic: [SOLVED] Destroy and Halt are failing  (Read 6447 times)

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
[SOLVED] Destroy and Halt are failing
« on: April 18, 2017, 01:00:04 am »
After the Halt command failed I inserted before command application.Destroy.
Code: Pascal  [Select][+][-]
  1. Application.Destroy;
  2. Halt;
Application.Destroy Command was failed in application.inc file in line 165:
Code: Pascal  [Select][+][-]
  1. inherited Destroy;
After this I commented line 165 in application.inc file.
Then Application.Destroy Command was filed in Win32WSButtons.pp file in line 491:
Code: Pascal  [Select][+][-]
  1. if ThemeServices.ThemesAvailable and
  2.   (Windows.SendMessage(Window, BCM_GETIMAGELIST, 0, Windows.LPARAM(@ButtonImageList)) <> 0) then


How can be solved this?
« Last Edit: April 22, 2017, 04:19:26 pm by yurkad »

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Destroy and Halt are failing
« Reply #1 on: April 18, 2017, 01:06:13 am »
Never ever call TObject.Destroy directly. Use TObject.Free instead.

In your case, calling Application.Terminate is the right way.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Destroy and Halt are failing
« Reply #2 on: April 18, 2017, 01:38:05 am »
After the Halt command failed I inserted before command application.Destroy.
Code: Pascal  [Select][+][-]
  1. Application.Destroy;
  2. Halt;
Application.Destroy Command was failed in application.inc file in line 165:
Code: Pascal  [Select][+][-]
  1. inherited Destroy;
After this I commented line 165 in application.inc file.
Then Application.Destroy Command was filed in Win32WSButtons.pp file in line 491:
Code: Pascal  [Select][+][-]
  1. if ThemeServices.ThemesAvailable and
  2.   (Windows.SendMessage(Window, BCM_GETIMAGELIST, 0, Windows.LPARAM(@ButtonImageList)) <> 0) then


How can be solved this?
1) always post the error message and all the required information.
2) try to always include a sample application with your question that shows the problem.
3) never ever forget to post your target widget, OS and processor. As far as I remember halt should work on windows on all cases.
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

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #3 on: April 18, 2017, 01:06:00 pm »
Quote
1) always post the error message and all the required information.
2) try to always include a sample application with your question that shows the problem.
3) never ever forget to post your target widget, OS and processor. As far as I remember halt should work on windows on all cases.

Error:
Exception of the class External: SIGILL
Direction: 580005

SO:
Windows XP Profesional Vers 2002 Service Pack 3

Processor:
Pentium(R) Dual Core CPU E5800 @3.20 GHz

Lazarus
1.6.4

In additional attachment.

And now I wll prepare sample application.
« Last Edit: April 18, 2017, 01:09:32 pm by yurkad »

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #4 on: April 18, 2017, 03:59:31 pm »
In attachment is sample of application with halt which is failed.

It seems the problem is in using of TComboBox control.
If disconnect using of TComboBox then halt is working.
For disconnect using of TComboBox check Disconnect ComboBox Using CheckBox.

For see  that halt is not works click on Test1 or Test2 node and after this click on Terminate
« Last Edit: April 18, 2017, 04:11:37 pm by yurkad »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Destroy and Halt are failing
« Reply #5 on: April 18, 2017, 04:10:30 pm »
I get sick of rar. I won't open it.
First learn to program
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #6 on: April 18, 2017, 04:27:27 pm »
Quote
First learn to program
Just I do it  ::)
« Last Edit: April 18, 2017, 04:40:15 pm by yurkad »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Destroy and Halt are failing
« Reply #7 on: April 18, 2017, 05:01:29 pm »
Yes, I know  :) I just tend to get impatient with age  :D
I will still try to help you, but the questions are a bit too simple... You have to do that yourself!
Then when it goes wrong, I will help you. Promise. O:-) 8-)

Example: you are capable of producing a debug screen, but you don't know what it means. First show us sourcecode.
Normally we know what is wrong in the first place. Which in your case is: all of it (sorry) but you will get better... ::)
« Last Edit: April 18, 2017, 05:04:46 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #8 on: April 18, 2017, 06:05:15 pm »
All is Ok  :D

jmm72

  • Jr. Member
  • **
  • Posts: 79
  • Very experienced in being a beginner...
Re: Destroy and Halt are failing
« Reply #9 on: April 18, 2017, 07:34:35 pm »
After this I commented line 165 in application.inc file.

Friendly advice: don't alter source files other than your own. Altering FPC or Lazarus source files might raise other errors that will be harder to detect, specially if we think they're in your source code and not in FPC or Lazarus due to them being modified. If you can make your program work by altering FPC or Lazarus, then either you've hit a bug and it should be reported, or your source code is way wrong  :)
Lazarus 1.6.4 + FPC 3.0.2 64bits under Windows 7 64bits
Only as a hobby nowadays
Current proyect release: TBA

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #10 on: April 18, 2017, 11:03:00 pm »
 jmm72, thank you by advice.
You are right.
Sample.rar has changed cod. But I tested it before send. Perhaps not so good.
The cod of sample.rar has same problem that source has.
Of course I could be wrong.
In future I will keep in mind this advice.

Sorry but I do not know difference between FPC source files and Lazarus source files.



yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #11 on: April 19, 2017, 02:43:46 pm »
I improve the project. Now Halt is working.
The problem was not in using TCombobox as such.
Apparently the problem was in using index of array itemLines out of range or something like that.
Just TCombobox controls  had two last indexes.
By using index of array itemLines out of range Halt is failing.

Lazarus is controlling many things but unfortunately he is not controlling use of indexes of arrays out of range. Even in runtime.
Delphi too.
« Last Edit: April 19, 2017, 02:46:30 pm by yurkad »

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #12 on: April 19, 2017, 04:01:38 pm »
Here in attachment is improved variant of project.

List of changes:
All changes was only in file link.pas.

Everywhere name itemLines was replaced by name itemLinkLines.
In additional line was changed in line 220. And after line 221 "begin" was inserted new line.

It is all.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Destroy and Halt are failing
« Reply #13 on: April 19, 2017, 04:30:00 pm »
Here in attachment is improved variant of project.

List of changes:
All changes was only in file link.pas.

Everywhere name itemLines was replaced by name itemLinkLines.
In additional line was changed in line 220. And after line 221 "begin" was inserted new line.

It is all.
Let me tell you this: programmers count from 0,naught, null 0 if you want.... You count from one.1 if you want... now do it again....
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

yurkad

  • Full Member
  • ***
  • Posts: 173
  • development
Re: Destroy and Halt are failing
« Reply #14 on: April 19, 2017, 04:52:13 pm »
Quote
Let me tell you this: programmers count from 0,naught, null 0 if you want.... You count from one.1 if you want... now do it again....
I did not understand your post and I did not understand the relationship between your post and my post.

In improved version it is used low and high for arrays,
« Last Edit: April 19, 2017, 04:57:23 pm by yurkad »

 

TinyPortal © 2005-2018