It looks like originMessage is never initialized.  Try changing:

Message* originMessage;
to
Message* originMessage = new Message();


-Dustin (nuleren)

2008/6/13 Ryan Neufeld <[EMAIL PROTECTED]>:
>
> Hey folks,
> As you might know I'm excited to announce that I have gotten a basic game of 
> Risk on TP up and running. In adding messaging to my Move::doTurn() I ran 
> into a segfault/Bus error that I haven't been able to fix. I'll give you a 
> run down of the procedure, my code, and a link to my gdb bt and bt full.
> Procedure:
> -Launch gdb --waitfor=tpserver-cpp
> -Launch tpserver-cpp from a "installed state" with the 
> modules/games/risk/testing-risk.conf config file (June 13th state)
> -Enter "run" in gdb
> -Logon to tpserver with jphr:jphr in tpserver-pywx
> -Download Universe
> -Select planet delta.
> -Create new Move order.
> - Add order to move 1 unit to gamma. OR/AND add order to move 1 unit to alpha.
> -Command-T in OS X to request the end of turn.
> -From here on in I'll show you my output.
> Results:
> In gdb:
> 2008-06-13 09:58:56 < Info  > End Of Turn started
> 2008-06-13 09:58:56 < Debug > Now processing orders of type: Colonize
> 2008-06-13 09:58:56 < Debug > Now processing orders of type: Reinforce
> 2008-06-13 09:58:56 < Debug > Now processing orders of type: Move
> 2008-06-13 09:58:56 < Debug > Starting a Move::dorOrder
> tpserver-cpp>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_PROTECTION_FAILURE at address: 0x00000004
> 0x91247036 in std::string::assign ()
> (gdb)
> bt and bt full:
> http://pastebin.com/f5a612d7e
>
> The code:
> Here is the messaging code that is causing the segfault (Bus error on OSX):
>    //Origin message setup
>    Message* originMessage; //message for origin planet owner.
>    assert(originMessage);
>
>    string originSubject = "test subject";  //Old Message -> /* "Move order(s) 
> via " + origin->getName() + " completed";*/
>    string originBody = "";
>
>    assert(originSubject != "");
>    originMessage->setSubject(originSubject); //Segfault here
> When the error started I had some contextual strings being set as the 
> subject. I simplified those strings to ensure the content was not the probem.
> I appreciate any help or advice you folks have to offer. Please let me know 
> if you need any more information or clarification. Thanks.
>
> Ryan 'jphr' Neufeld
> ---------------------------
> visit me at hammerofcode.com
>
> _______________________________________________
> tp-devel mailing list
> [email protected]
> http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel
>
_______________________________________________
tp-devel mailing list
[email protected]
http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel

Reply via email to