Recent

Author Topic: Problem with close form  (Read 3555 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2259
    • Lazarus and Free Pascal italian community
Problem with close form
« on: April 17, 2016, 02:44:48 pm »
Hello guys I have a problem in the closing form created at run time. On linux this error does not occur, but on a window yes.

External exception C0000008

Debugging I realized that the problem is in the:

procedure TCustomForm.Close;

in the case

Code: Pascal  [Select][+][-]
  1.       case CloseAction of
  2.         caHide: Hide;
  3.         caMinimize: WindowState := wsMinimized;
  4.         caFree:
  5.           begin
  6.             // if form is MainForm, then terminate the application
  7.             // the owner of the MainForm is the application,
  8.             // so the Application will take care of free-ing the form
  9.             // and Release is not necessary
  10.             if IsMainForm then
  11.               Application.Terminate
  12.             else
  13.               Release;
  14.           end;
  15.       end;  
  16.  

And enters the branch caHide , but the correct way is caFree. Why this? Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

zeljko

  • Hero Member
  • *****
  • Posts: 1812
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Problem with close form
« Reply #1 on: April 17, 2016, 08:52:59 pm »
Show your code so maybe somebody can help you.

xinyiman

  • Hero Member
  • *****
  • Posts: 2259
    • Lazarus and Free Pascal italian community
Re: Problem with close form
« Reply #2 on: April 18, 2016, 08:35:48 am »
I resolved, the problem was that I was doing the form of Hyde .Free of my parallel thread. On linux work but on the window .Free generates quell'eccezzione. I solved it by removing the .Free
But how did this happen?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

zeljko

  • Hero Member
  • *****
  • Posts: 1812
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Problem with close form
« Reply #3 on: April 18, 2016, 09:45:46 am »
Do you set CloseAction in OnFormClose ?

 

TinyPortal © 2005-2018