Recent

Author Topic: Please, help with program debugging  (Read 4531 times)

Rodion

  • Newbie
  • Posts: 4
    • Game World Imaging
Please, help with program debugging
« on: April 03, 2011, 11:22:43 am »
Hello.
I'm writing house design application in Free Pascal 2.4.2 + Lazarus 0.9.29, with 2D and 3D visualization in DirectX9 - made as dll in Visual C++ 2008 EE. I store scene data in XML files and have such a problem - when I several times open scene - there is always error occurs - see attached GDB back trace.

It happens in this piece of code -

Code: [Select]
XMLDoc                                := nil;

    ReadXMLFile ( XMLDoc, FN );
    TempNode                            := XMLDoc.DocumentElement.FindNode ( FLOORS_NODE_NAME );  
    
    

    //---Бегаем по этажам--------------------------------
    for i := 0 to TempNode.ChildNodes.Count - 1 do begin    
      Scenes.S.WriteToFloors ( TempNode.ChildNodes.Item [ i ].Attributes.Item [ 0 ].NodeValue, StrToFloat ( TempNode.ChildNodes.Item [ i ].Attributes.Item [ 1 ].NodeValue ) );      
      
      
      
      //---Бегаем по объектам----------------------------
      for j := 0 to StrToInt ( TempNode.ChildNodes.Item [ i ].Attributes.Item [ 2 ].NodeValue ) - 1 do begin      
        Scenes.S.WriteToObjects ( Scenes.S.PrevFloor,
                                  StrToInt ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 0 ].NodeValue ) + PEREMETRIAL_OBJECT * StrToInt ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 9 ].NodeValue ),     // Flags
                                  StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 1 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 3 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 5 ].NodeValue ),            // X1, Y1 и Z1
                                  StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 2 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 4 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 6 ].NodeValue ),            // X2, Y2 и Z2
                                  StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 8 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 7 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 10 ].NodeValue ) );         // BlockHeight, Height и StepFromFloor
      
      end;
      
      
      
      //---Бегаем по украшениям--------------------------
      j                                 := j + 1;
      for k := j to j + StrToInt ( TempNode.ChildNodes.Item [ i ].Attributes.Item [ 3 ].NodeValue ) - 1 do begin      
        Scenes.S.WriteToDecorations ( Scenes.S.PrevFloor,
                                      StrToInt ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 0 ].NodeValue ),     // Flags
                                      StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 1 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 2 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 3 ].NodeValue ),            // X, Y и Z
                                      StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 4 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 5 ].NodeValue ), StrToFloat ( TempNode.ChildNodes.Item [ i ].ChildNodes.Item [ j ].Attributes.Item [ 6 ].NodeValue ) );          // RotX, RotY и RotZ        

      end;
    
    end; //-for
  
  if XMLDoc <> nil then begin    
    XMLDoc.Free;
    XMLDoc                              := nil;
    
  end;

On line "XMLDoc.Free;". If scene already exists on each open - it is freed automatically, and new scene is loaded. It seems, that it is internal error of "fcl-xml" - so how to solve it? When I comment out this line - everything works fine.
« Last Edit: April 03, 2011, 01:30:46 pm by Rodion »
Imagination Works - my web site.

 

TinyPortal © 2005-2018