PlaneShift

Development => Development Deliberation => Topic started by: g_remlin on January 12, 2012, 05:30:41 pm

Title: Subject: Fix segfault when opening 'Skills and stats' window
Post by: g_remlin on January 12, 2012, 05:30:41 pm
Move message subscription to the end of window post-initialisation.
If a message arrives before post-initialisation has completed, access
to uninitialised variables can occur, causing a segfault.
Make message subscription the very last action.

---
 trunk/src/client/gui/pawsskillwindow.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/trunk/src/client/gui/pawsskillwindow.cpp b/trunk/src/client/gui/pawsskillwindow.cpp
index 6f0f089..e47bdaf 100644
--- a/trunk/src/client/gui/pawsskillwindow.cpp
+++ b/trunk/src/client/gui/pawsskillwindow.cpp
@@ -93,8 +93,6 @@ bool pawsSkillWindow::PostSetup()
     {
         return false;
     }
-    psengine->GetMsgHandler()->Subscribe(this, MSGTYPE_GUISKILL);
-    psengine->GetMsgHandler()->Subscribe(this, MSGTYPE_FACTION_INFO);
 
     xml =  csQueryRegistry<iDocumentSystem > ( PawsManager::GetSingleton().GetObjectRegistry());
 
@@ -143,6 +141,9 @@ bool pawsSkillWindow::PostSetup()
     currentTab =0;
     previousTab =0;
 
+    psengine->GetMsgHandler()->Subscribe(this, MSGTYPE_GUISKILL);
+    psengine->GetMsgHandler()->Subscribe(this, MSGTYPE_FACTION_INFO);
+
     return true;
 }
Title: Re: Subject: Fix segfault when opening 'Skills and stats' window
Post by: bilbous on January 12, 2012, 06:19:43 pm
Patches are better suited to the  bugtracker  (http://hydlaaplaza.com/flyspray/) they might not get noticed here.
Title: Re: Subject: Fix segfault when opening 'Skills and stats' window
Post by: g_remlin on January 12, 2012, 06:53:20 pm
I'm not a prospect, this is not for the 'Dev's' (who don't accept patches anyway).
This is here for those that compile their own, and are not on #Planeshift-build when I am...
Title: Re: Subject: Fix segfault when opening 'Skills and stats' window
Post by: Aiwendil on January 12, 2012, 07:18:28 pm
I'm not a prospect, this is not for the 'Dev's' (who don't accept patches anyway).
You are clearly doing it wrong then. In fact it's pretty simple to get "valid" patches submitted in the PS code tree. You just have to argue with some of the devs for years, rant about them whenever possible and make yourself really unpopular. Then your patches get included at once. ;)
Title: Re: Subject: Fix segfault when opening 'Skills and stats' window
Post by: weltall on January 12, 2012, 07:50:02 pm
patch are usually accept provided they don't go against the goals and design of the game(and they cannot be configured somehow to go toward that. How the setting should be done depends on the change), they lack proper commenting, they use a wrong style or they don't fix things correctly (fixing the result and not the cause is an example of this)