Invalid Pointer Operation, advice requested with debugging

Posted by Xanyx on Stack Overflow See other posts from Stack Overflow or by Xanyx
Published on 2010-05-31T22:50:32Z Indexed on 2010/05/31 22:53 UTC
Read the original article Hit count: 191

Filed under:
|

I appear to have created code that is trashing memory.

Having never had such problems before, i am now settign an Invalid Pointer Operation.

In the following the value of the const string sFilename gets trashed after my call to PromptForXYZPropertiesSettings.

// Allow the user to quickly display the properties of XYZ without needing to display the full Editor function PromptForXYZProperties(const sFilename:string; var AXYZProperties: TXYZProperties): boolean; var PropEditor: TdlgEditor; begin PropEditor:= TdlgEditor.create(nil); try PropEditor.LoadFromFile(sFilename);

Other Details:

  • Delphi 2007, Windows 7 64 bit, but can reproduce when testing EXE on XP
  • REMOVING CONST STOPS PROBLEM FROM EXHIBITING (but presumably the problem is thus just lurking)
  • PropEditor.PromptForXYZPropertiesSettings creates and shows a form. If I disable the ShowModal call then the memory is not trashed. Even though i have REMOVED ALL CONTROLS AND CODE from the form

So I would like some advice on how to debug the issue. I was thinking perhaps watching the memory pointer where the sFilename var exists to see where it gets trashed, but not sure how i would do that (obviously needs to be done within the app so is owned memory).

Thanks

© Stack Overflow or respective owner

Related posts about delphi

Related posts about memory