Very strange error in my app from component

ぃ、小莉子 提交于 2019-12-13 03:38:44

问题


Ok my application does everything that is it suppeded to do and it does the same thing every time so its not as if testing was gone be that much trouble.

it crashes "somtimes" not always. it does this when i hover the mouse over a file in the open file dialog i have recently outputted. not instantly it waits about half second to a second, and i know that is when the openfiledialog brings up data such as file size and when it was created and what type of document it is..(standard)mouse hover info.. the thing is this is using the "opendialog" and i didnt write this code so this error is not of my doing is it?????? if it is how,, if it is not how/what can i do to stop it..

the type of error is a "acces violation at address " bla...

the open file dialog has no filters and is exactly as it off compoent tray and it crashes after i call "opendialog.execute"

i initialy thought that it may still be writing to it but then it continued after i stoped the app opening any new file untill the last one had compleated the save process.

as i said it doesnt even happen 100% all the time,, and its not machine specific.. crashes on 3 different win xp pc's.

HELP!!

Additional; findings i can open and run the file and all is well as long as i dont make a hint box to pop up on a file i have created.


回答1:


Drop an TApplicationEvents component on your form and add an event handler for the OnHint event. Then put a break point in there and see if you can break on that before it crashes (as you said, it sounds like it is crashing when it tries to display the hint). Then you can compile with debug DCU's and trace in and see what it is crashing on.

My guess is you still have a file handle with an exclusive lock on the file maybe. Check your file handles and make sure you are properly closing them. What happens if you try to open one of those files from notepad while the program is running?

The intermittent behavior might be related to a different code path on an error condition that leads to a leaked file handle.

Good luck!




回答2:


The open-file dialog is basically an explorer instance. Which means every shell extension you have installed gets loaded too. One problem with this is that once you use the open-file dialog, every shell extension also uses your stack to store variables/return addresses, ... If your stack is not big enough, this can lead to crashes.

Try increasing the stacksize of your application.




回答3:


The access violation is most probably not related to the open dialog at all. I strongly you suggest you look in your code and make sure you are not over-writing memory bounds -if you are using dynamic arrays check and ensure that you are not accessing an element outside of its boundary; the same thing if you are manually allocating memory.

If you are not already using FastMM, use it. It has some good memory sanity checks.




回答4:


I propose you attach a debugger to the process, and find out what exactly makes the program crash. This should get you started...



来源:https://stackoverflow.com/questions/473966/very-strange-error-in-my-app-from-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!