|
This thread is locked; no one can reply to it. |
1
2
|
Program doesn't quit |
Arvidsson
Member #4,603
May 2004
|
I've started to encounter a strange problem when I try to quit my program. In 8 of 10 tries, the program still runs (as seen in my attached screenshot) and I have to terminate it with force (ctrl-alt-del). I don't think there's anything wrong with my code since I've seen this happen with other allegro programs, and the last thing my program does is writing to a logfile which it accomplishes. I'm using the latest WIP and Windows XP. Any idea what might be wrong?
|
ReyBrujo
Moderator
January 2001
|
Which other Allegro programs? Not much we can do, except guess. -- |
kazzmir
Member #1,786
December 2001
|
99% chance there is a memory leak in your code. |
Arvidsson
Member #4,603
May 2004
|
It has happened after quitting KQ, and the examples to Mappy. Although not as often, so it's probably a leak then. Are there any tools to monitor leaks or something like that? I'm using MingW. UPDATE: I've gone through my code many times now, and now I'm doubting that it is a leak The only thing I'm allocating memory for is a buffer bitmap and that's it. I don't alloc anywhere else. UPDATE2: I compiled and installed Allegro 4.0.3 and now the situation has improved. It still doesn't quit sometimes but now it's not that bad, I can just alt-f4 and that's that. Before I had to go through two annoying dialog boxes. Still, this confuses me... A thought: The volatile timer variables I'm using exists inside a typedef structure. Is that ok, or could that have to do with this somehow? Maybe I have to declare the whole structure volatile? UPDATE3: I've attached the program. If anyone could run it a few times and see if they also get my problems, it would be helpful (hopefully). When the program starts, press alt (if alt key doesn't work, change in setup.cfg) and then escape to quit. It doesn't do anything more than that.
|
A J
Member #3,025
December 2002
|
do any of the allegro examples hang on exit ? ___________________________ |
Arvidsson
Member #4,603
May 2004
|
No, they seem to be working alright.
|
clovekx
Member #3,479
April 2003
|
I have the same problem with my programs on Win XP. --- |
flares
Member #3,463
April 2003
|
same here, often times after they exit the windows on the taskbar is just there and it doesn't go aways i have to do a a task kill to get rid of it. i have run my proggies through GDB and still nothing it doesn't happen all the time, just every now and then. [nonnus29]Plus the api is crap ... I'd rather chew broken glass then code with those. |
Evert
Member #794
November 2000
|
All using the latest WIP? |
Arvidsson
Member #4,603
May 2004
|
The program I attached in an earlier post reproduces it for me very frequently. Has anyone tried it? Am using the latest WIP. EDIT: made a new version, escape to quit, f1 to show fps. I had to manually kill this one once every four tries at LEAST. See if you can replicate it. EDIT2: I ran through all the examples once. extrans.exe, exexedat.exe and excolmap.exe reproduced the error.
|
Marco Radaelli
Member #3,028
December 2002
|
I ran you attached program ten times and it quits cleanly with ESC. Just an idea: which version of DirectX are you using?
|
flares
Member #3,463
April 2003
|
yes the latest alleg4.1.7 dx8.0 winxp sp2 mingw 3.2.3 msys 1.0, i'll test tommorrow, [nonnus29]Plus the api is crap ... I'd rather chew broken glass then code with those. |
Rick
Member #3,572
June 2003
|
Quote: I have the same problem with my programs on Win XP. I have the same thing. With MSVC++ 6.0 I'll press escape (to exit the program) and the window closes, but it's still running. I have to do a shift-F5 to stop the debugger. I know I have memory leaks but why would that effect closing the program. ======================================================== |
Evert
Member #794
November 2000
|
Quote: yes the latest alleg4.1.7 That's not the latest WIP. Shouldn't make too much of a difference though... |
tobing
Member #5,213
November 2004
|
When you have memory leaks and you use a debug build, then MSVC runtime tries to collect infos about the allocated but not free'd memopry chunks. It's that what needs time, so that's probably what you have here. |
clovekx
Member #3,479
April 2003
|
I have that problem with 4.0.3. --- |
tobing
Member #5,213
November 2004
|
If it is this it doesn't depend on the allegro version or any library, it always occurs if you have a debug build and a memory leak, so the runtime tries to find out all the details. |
Arvidsson
Member #4,603
May 2004
|
But surely the examples shouldn't have any memory leaks? Still I got the same problem with those. I tried compiling my project using both the relase and debug build and it didn't matter. The program still won't die. I'm using: alleg 4.1.18
|
clovekx
Member #3,479
April 2003
|
I have that problem without debugger. Allegro quiting functions should be checked. --- |
Thomas Fjellstrom
Member #476
June 2000
|
Sory but I've not noticed the problem. Even on windows. -- |
Arvidsson
Member #4,603
May 2004
|
I've done some testing and I think I am on to something. I changed my program so that it didn't rely on allegro's atexit routines, I manually placed all the remove_timer(), remove_keyboatd(), yada yada, functions and recompiled. I ran it 50 times and it worked like a charm. Then I changed it all back, recompiled. I ran it 7 times until it collapsed on exit again. THEN I changed it back AGAIN I ran it 39 times, but this time it froze upon exit but not like usual. It seemed like the program was still running, but unable to get input. But here comes the interesting part. After I quit the program I looked through my logfile. I had logged messages before almost every function and now it got to right before remove_timer() but didn't log the message right after that one. Conclusion, the program froze when running the remove_timer() function. Now, what to do with this information is up to someone else
|
Elias
Member #358
May 2000
|
This is a wild guess I just posted on [AD] - but can you try removing the #undef ALLEGRO_MULTITHREADED from timer.c, and see if the problem persists? -- |
Arvidsson
Member #4,603
May 2004
|
I used the wrong dll:s. I have placed some logs in remove_timer() and will see if removing #undef... is going to solve it. EDIT: Nope, that wasn't the solution. The logfile indicates that the error happens in timer_driver->exit() EDIT2: I went further and added logs in tim_win32_exit()from wtimer.c The logfile indicates that the error happens in WaitForSingleObject(timer_thread, INFINITE) After reading about WaitForSingleObject() on msdn, I understand that this is where the program gets stuck. Why not use a specified interval? If the return value is WAIT_TIMEOUT try to close the handle anyway. That's what I have to do manually anyway EDIT3: I changed tim_win32_exit() to wait 5 seconds and then quit anyway. Worked like a charm, although I don't know what malice comes out of it. static void tim_win32_exit(void) { /* acknowledge that the thread should stop */ SetEvent(timer_stop_event); /* wait up to 5 seconds for thread to end */ if (WaitForSingleObject(timer_thread, 5000) == WAIT_TIMEOUT) al_trace(" wtimer.c: thread didn't end\n"); /* thread has (hopefully) ended, now we can release all resources */ CloseHandle(timer_stop_event); } Now, I'm gonna revert my program code to using allegro's atexit stuff. Hopefully, the thingy on the taskbar will dissappear after 5 seconds. EDIT4: YESSSS! That was indeed the problem! The program quits after 5 seconds and no more thingys left on the taskbar. Sweet... What do the developers have to say about this? What should be done?
|
Oscar Giner
Member #2,207
April 2002
|
I've always though that was a MSVC bug It only happens when you run the program from MSVC, so... -- |
Thomas Fjellstrom
Member #476
June 2000
|
Something is wrong if the timer thread isn't being killed properly.. -- |
|
1
2
|