ResidualVM logo Forum Index - ResidualVM website - Contact us - Rules Login    Register     Search curved edge
It is currently Fri Dec 14, 2018 10:07 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Apr 11, 2012 3:40 am 
Offline
User avatar

Joined: Sat Mar 31, 2012 10:19 pm
Posts: 9
Was playing through GF with my own compiled version of the code that was built maybe a week ago (so it's not quite the latest dev trunk). I got to the part with the octopus and the perl and had a seg fault. It was very repeatable, like clockwork just after Manny's dialog "I don't like the way he's looking at us".

So, wanting to move on in the game, I recompiled with debug symbols and ran it in GDB to try and find the source of the seg fault. Turns out it was pretty easy to find. There's a bit in Head::lookAt() where it tries to grab the orientation matrix for the parent of joint3Node but it never checks to make sure the parent exists. I'm sure in a perfect would it always would but in this case it was NULL. It tries to memcopy out this member of a null object and boom, seg fault.

I added a check that will use a fresh matrix (presumably identity) if the parent is NULL. Here's the diff for head.cpp that does the trick (just a one-line change). This fixed the crash for me. Just thought I'd offer this up as a possible bug fix.

Ollie

Code:
diff --git a/engines/grim/costume/head.cpp b/engines/grim/costume/head.cpp
index fae1fbb..122ac82 100644
--- a/engines/grim/costume/head.cpp
+++ b/engines/grim/costume/head.cpp
@@ -105,7 +105,7 @@ void Head::lookAt(bool entering, const Math::Vector3d &point, float rate, const
                // the orientation in parent space (as yaw/pitch/roll).
               
                // Get the coordinate frame in which we need to produce the character head yaw/pitch/roll values.
-               Math::Matrix4 parentWorldTM = _joint3Node->_parent->_matrix;
+        Math::Matrix4 parentWorldTM = (_joint3Node->_parent?_joint3Node->_parent->_matrix:Math::Matrix4());
               
                // While we could compute the desired lookat direction directly in the above coordinate frame,
                // it is preferrable to compute the lookat direction with respect to the head orientation in


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2012 3:57 am 
Offline
User avatar

Joined: Sat Mar 31, 2012 10:19 pm
Posts: 9
Awww, nevermind. Just pulled the latest changes and it looks like this already got fixed a week ago. :oops:

Ollie


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

All times are UTC


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

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Forum design by ScummVM team, icons by raina, adopted for ResidualVM
curved edge   curved edge