#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    São Paulo - Brazil
    Posts
    35
    Rep Power
    2

    Error in class allocation?


    Suddenly I became to receive the message:

    Project xxxxx.exe raised exception class EResNotFound with message 'Resource TfrmUpt60100 not found'

    I respond "break" and the execution seems to stopped in the line

    With TFrmUpt60100.Create(Self) do

    The declaration of the class is:

    TfrmUpt60100 = Class(TForm)

    It's important to note that the error appears suddenly. After thousands of executions. I suppose that "Upt60100.dfm" was corrupted in some moment.

    The question is:

    Is there a way to recover this file? It seems that I will need to do again all modifications since the last back up. And manually.

    Some suggestion?

    Delphi XE Version 15.0.3890.34076

    Greetings from São Paulo - Brazil

    Ricardo
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    350
    Rep Power
    7
    Maybe you mistakenly deleted

    {$R *.dfm}

    from your source code, which by default is placed right after the IMPLEMENTATION directive.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    São Paulo - Brazil
    Posts
    35
    Rep Power
    2
    Unfortunately this is not the case. See below:
    .
    .
    idSistema: Integer;

    implementation

    uses UptFunc, Upt60101, UptDTM, Upt60102;

    {$R *.DFM}

    procedure TFrmUpt60100.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
    Action := caFree;
    FrmUpt60100 := nil;
    end;
    .
    .
    .
    Thank you very much
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    I think you need to remove this:
    Code:
    FrmUpt60100 := nil;
    You are setting the pointer to your object to nil before it has been destroyed.

    Comments on this post

    • Luthfi disagrees : Since it is destroyed, there is no harm to "reset" references to the destroyed object.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    São Paulo - Brazil
    Posts
    35
    Rep Power
    2
    The reported error occurs in the first creation of the Form. Then, the OnClose method was not executed.

    Cheers

    Ricardo
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    Originally Posted by clivew
    I think you need to remove this:
    Code:
    FrmUpt60100 := nil;
    You are setting the pointer to your object to nil before it has been destroyed.

    Comments on this post
    Luthfi disagrees: Since it is destroyed, there is no harm to "reset" references to the destroyed object.
    Clivew believes Luthfi is wrong.
    The form has not been destroyed before the formClose event has returned, so setting the form pointer to nil inside that event is unwise at the very least.

    Clive
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    I just noticed that you say that you are creating the form with the Line
    Code:
    With TFrmUpt60100.Create(self)
    In which case, where are you creating it?
    To what does self refer?
    Is FrmUpt60100 that you are freeing ever actually created?

    Clive

IMN logo majestic logo threadwatch logo seochat tools logo