Problems to free an Object lazarus / 61-Beginners ---------------------------------------------------------------------- krull · 2017-05-20 15:25 Hello, I think this is the last time, I need help with this program. It should become a vertical shoot 'em up. The problem is that everytime if you take the 1UP('heart') or if it leaves screen bounderies, you get an Error back. Here the procedures for 'heart' and the Invocation of the Object. Thank for your Help. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.EnemyControlTimer(Sender: TObject);begin  randomize;  if Enemy1.FreeMe=true then  begin    if not (Assigned (heart1)) {and (random(8)=8)} then    begin      heart1:=THeart.create();      heart1.pHeart:=Enemy1.pEnemy1;    end;    Enemy1.destroy();    Enemy1:=TEnemy1.create(1);  end;  if Enemy2.FreeMe=true then  begin  if not (Assigned (heart1)) {and (random(8)=8)} then    begin      heart1:=THeart.create();      heart1.pHeart:=Enemy2.pEnemy1;    end;  Enemy2.destroy();    Enemy2:=TEnemy1.create(2);  end;  if Player1.FreeMe=true then  begin    Player1.destroy(); sleep (500); halt(0)  end;  if Assigned(heart1) and Heart1.FreeMe=true then  begin    FreeAndNil(heart1);  end;end;                 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i constructor THeart.create();begin  heart:=TBGRABitmap.Create('thunderflash.png');  heartSpeed:= 8;  FreeME:=false;  heartPosTimer := TTimer.Create(nil);  heartPosTimer.Interval := 25;  heartPosTimer.OnTimer := @heartPosTimerTimer;  heartPosTimer.Enabled := true;end; destructor THeart.destroy();begin end; procedure THeart.heartPaint(p:Point;pOld:Point);begin  Form1.Canvas.FillRect(pHe artFormer.x,pHeartFormer.y,pHeartFormer.x+heart.Width,pHeartFormer.y+h eart.Height);  heart.draw(Form1.Canvas,pHeart.x,pheart.y,true);end; procedure THeart.heartPosTimerTimer(Sender: TObject);label 2;begin  if pHeart.y>=Form1.Height then  begin    FreeMe:=true;  GoTo 2;  end;  if (Player1.pPlayer.x