Homesource Forums

Homeworld Source Editing Talk
It is currently Fri Oct 31, 2014 11:19 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: r361 just won't die.
PostPosted: Mon Dec 04, 2006 2:53 pm 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

On Linux, it hangs on exit. (r360 is okay :) )

Aunxx
---
Sat in his deck-chair admiring the Garden of Kadesh.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 3:13 pm 
Offline
coder

Joined: Wed Nov 15, 2006 8:15 am
Posts: 100
Yes it hangs for me too, since build r360.

It comes from the utyGameSystemsShutdown -> soundEventClose -> soundrestore() function in src/SDL/soundlow.c which is hanging in a while.

I don't know yet why it's hanging, but it looks like, this code was never access during shutdown before so it must contain a lot of bugs.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 5:01 pm 
Offline
coder
User avatar

Joined: Tue Dec 14, 2004 3:24 pm
Posts: 324
Location: UK (UTC+0)
Are you sure r360 is OK? I would have expected that r360 would be broken to as it must surely be due to this change:

Code:
Modified: homeworld/trunk/src/SDL/main.c
===================================================================
--- homeworld/trunk/src/SDL/main.c   2006-12-03 04:39:49 UTC (rev 359)
+++ homeworld/trunk/src/SDL/main.c   2006-12-03 18:33:53 UTC (rev 360)
@@ -3112,9 +3112,11 @@

             if (SDL_PollEvent(&e))
             {
-                if (e.type == SDL_QUIT)
+                event_res = HandleEvent(&e);
+
+                if (e.type == SDL_QUIT) {
                     break;
-                event_res = HandleEvent(&e);
+                }
             }

which now processes SDL_QUIT events, rather than quitting immediately, so that other shutdown tasks are run (the one I was interested in was saving of changed user preferences). Anyway, I think the problem is that soundrestore()'s loop may expect other threads to keep going and eventually shut the sound down at which point its while() condition fails and the program continues. Because SDL is now running the event queue that may not be happening in quite the same way.

(I would look into it more but having fallen on the base of my spine on the way home I'm not really in the right frame of mind to do anything properly - except go to bed. Instant Karma. Earl Hickey is evidently on to something...)

_________________
MacHomeworld | HomeworldSDL.org


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 5:30 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Mornin'

Hope you're felling better lmop, or at the least resting. :)

I tried again and r360 does hang, but oddly enough it didn't yesterday when I tried it.

I'll amend my code for building a Linux binary, and we'll look into fixing this.

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 6:34 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

Scuse this, but I'm logged in on a system without anu source code and testing on another machine, but if you make a slight change, it all seems to work.

change the
Code:
event_res = HandleEvent(&e);

line to after the if SDL_QUIT test, a la
Code:
             if (SDL_PollEvent(&e))
             {
                if (e.type == SDL_QUIT) {
                    break;
                }
                event_res = HandleEvent(&e);
               
             }


Can someone else check this for me as I think we need to test this before committing it?

Aunxx
---


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 6:55 am 
Offline
coder
User avatar

Joined: Tue Dec 14, 2004 3:24 pm
Posts: 324
Location: UK (UTC+0)
That basically undoes my change so whilst you work around the sound hang issue you break other stuff (that's been broken for a while admittedly). If you can't fix the sound issue then please wrap the change in a #ifdef _LINUX or #ifdef _MACOSX because sound doesn't work on Mac OS X and saving user preferences is quite important. Thanks.

_________________
MacHomeworld | HomeworldSDL.org


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 7:49 am 
Offline
coder

Joined: Wed Nov 15, 2006 8:15 am
Posts: 100
Ok found why the whil is not quitting.

It's because, it needs mixer.status == SOUND_FREE and no function in the whole code which set mixer.status to this value except the soundinit function.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 7:50 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

Sorry, didn't intend to undo what you've been doing. :(

I'm trying to sort out the warnings in the SaveGame file and I need a working compile to test it against.

I'll try and see what's broken later unless someone else gets chance. :) :)

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 3:49 pm 
Offline
coder
User avatar

Joined: Tue Dec 14, 2004 3:24 pm
Posts: 324
Location: UK (UTC+0)
azurief in r365 wrote:
other functions that cause segfault have been put between #ifdef _MACOSX_FIX_ME

Technically that should be #ifndef _LINUX_FIX_ME since its not the Mac version that needs fixing. :) The _FIX_ME tags are meant to make it easy to search for hacks/broken code that needed revisiting, whilst the platform part of the #define was the one with the issue. It does mean that you would have to compile with two build flags though: _LINUX and _LINUX_FIX_ME (which is what happens for the Macintosh version).

On another note, I'm really surprised at the number of other shutdown tasks that fail. It's interesting that all are related to hardware and therefore now interface with the SDL libraries... I'll take a look later tonight.

_________________
MacHomeworld | HomeworldSDL.org


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 4:39 pm 
Offline
coder

Joined: Wed Nov 15, 2006 8:15 am
Posts: 100
Sorry, wasn't sure of the #ifdef or #ifndef to use, so I put the one for Mac :oops:

I didn't take time to look at the code in the functions that fails but I was really surprised that so much were failing.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 3:23 pm 
Offline
coder
User avatar

Joined: Wed Oct 04, 2006 8:13 pm
Posts: 92
Location: UTC -0500
(update 1)

(for reference)

http://homeworldsdl.org/pipermail/commi ... 00142.html

r365 | azurief | 2006-12-05 18:05:24 +0000 (Tue, 05 Dec 2006)

The function soundEventClose() that cause the game hanging when quitting under Linux and other functions that cause segfault have been put between #ifdef _MACOSX_FIX_ME as it seems to work under Mac OSX but don't know yet how it works under Win 32.

http://homeworldsdl.org/pipermail/commi ... 00144.html
r367 | nova | 2006-12-05 21:26:03 +0000 (Tue, 05 Dec 2006)

changed to #ifndef _LINUX_FIX_ME
--------------------------------------------

http://homeworldsdl.org/pipermail/commi ... 00198.html
r423 | nova | 2006-12-15 20:21:12 +0000 (Fri, 15 Dec 2006)

win32 fixmes to allow hwsdl-win32 to exit without freezing or crashing.

soundlow.c
fixme inside soundrestore(void)

utility.c
fixme'd mouseShutdown() and ferShutdown()

_________________
http://againsttcpa.com/what-is-tcpa.html
http://google.com/search?q=c+programming+faq
http://research.att.com/~bs
acronyms.ch, neworder.box.sk


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group