| |

VerySource

 Forgot password?
 Register
Search
View: 1928|Reply: 9

Why is an access violation add address error reported when the program is closed?

[Copy link]

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-29 17:40:01
| Show all posts |Read mode
This error is reported every time the program is closed. What is going on?
Reply

Use magic Report

0

Threads

27

Posts

24.00

Credits

Newbie

Rank: 1

Credits
24.00

 China

Post time: 2020-3-4 03:15:01
| Show all posts
Give me some code to know
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-3-4 23:15:01
| Show all posts
Where does this code go? When I close the program, I call Application-> Terminate () directly, and then I report an error, but I have no problem with following the breakpoint here, and I can exit normally.
Reply

Use magic Report

0

Threads

14

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-5 22:00:01
| Show all posts
This problem is hard to say. It is estimated that you have terminated it before anything is closed, but setting a breakpoint run has given enough time to complete that task.
Reply

Use magic Report

0

Threads

12

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-3-8 23:00:02
| Show all posts
After some memory was released, it was accessed again.
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-14 11:30:01
| Show all posts
See what you did when running the program, which caused this error.
For example: If after running the program, the program exits directly and an error occurs, it may be that during some program startup events, there is a problem with some piece of code, the pointer may be out of bounds and the like. Try to block this code or some of it to see if it still makes a mistake, so as to determine where the code is wrong.
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-3-24 09:00:01
| Show all posts
I opened a child window, after running some code in the child window, closing the child window, an error occurred when closing the main window, but there was no error when closing the child window.
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-26 23:15:01
| Show all posts
You'd better release the dynamically allocated memory in your program explicitly, such as: free, dealloc ..., Close, etc., especially the release of some object instances, such as: form
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-27 16:45:01
| Show all posts
Personally think that you have a problem when closing the child window and the main window. Generally, a form1 calls another form2 (dynamically created) process: Form2 = new TForm2 (this);
          Form2-> ShowModal ();
          Form2-> Close ();
          Form2 = Null;
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-4-2 00:15:01
| Show all posts
Thank you Rufeng, I changed the program a little bit.

Now I want to send a message to the main form when the child window is closed, delete the subform pointer and assign NULL

Here is the added message map
    BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER (WM_FORM_CLOSE, TMessage, CMMessage)
    END_MESSAGE_MAP (TForm1)

Custom message, the program runs together hereEND_MESSAGE_MAP (TForm1) Here is the stack overflow, why is this?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list