« Return to Thread: WorldGui:: Load throwing a seg fault

WorldGui:: Load throwing a seg fault

by alex wood-3 :: Rate this Message:

| View in Thread

Hi all,

This one has me stumped.

I seem to be getting a seg fault when I try and call WorldGui::Load
with the simple.world file (unmodified)

The valgrind output is as follows:


==8663== Invalid read of size 4
==8663==    at 0x447E426: ??? (in /usr/lib/mesa/libGL.so.1.2)
==8663==    by 0x40DC1D3: Stg::Canvas::InitGl() (in
/usr/local/lib/libstage.so.4.1.1)
==8663==    by 0x40DC331: Stg::Canvas::resize(int, int, int, int) (in
/usr/local/lib/libstage.so.4.1.1)
==8663==    by 0x46742DA: Fl_Group::resize(int, int, int, int)
(Fl_Group.cxx:533)
==8663==    by 0x46B070B: Fl_Window::resize(int, int, int, int) (Fl_x.cxx:1032)
==8663==    by 0x46AEB10: fl_handle(_XEvent const&) (Fl_x.cxx:997)
==8663==    by 0x46AF6AD: do_queued_events() (Fl_x.cxx:176)
==8663==    by 0x46AF94C: fl_wait(double) (Fl_x.cxx:201)
==8663==    by 0x465DB94: Fl::wait(double) (Fl.cxx:368)
==8663==    by 0x465DC3B: Fl::check() (Fl.cxx:412)
==8663==    by 0x40E96BB: Stg::WorldGui::Load(std::string const&) (in
/usr/local/lib/libstage.so.4.1.1)
==8663==    by 0x804F51A: StageUI::createWorld(std::string) (StageUI.cpp:34)
==8663==  Address 0x430 is not stack'd, malloc'd or (recently) free'd
==8663==
==8663==
==8663== Process terminating with default action of signal 11 (SIGSEGV)
==8663==  Access not within mapped region at address 0x430
==8663==    at 0x447E426: ??? (in /usr/lib/mesa/libGL.so.1.2)
==8663==    by 0x40DC1D3: Stg::Canvas::InitGl() (in
/usr/local/lib/libstage.so.4.1.1)
==8663==    by 0x40DC331: Stg::Canvas::resize(int, int, int, int) (in
/usr/local/lib/libstage.so.4.1.1)
==8663==    by 0x46742DA: Fl_Group::resize(int, int, int, int)
(Fl_Group.cxx:533)
==8663==    by 0x46B070B: Fl_Window::resize(int, int, int, int) (Fl_x.cxx:1032)
==8663==    by 0x46AEB10: fl_handle(_XEvent const&) (Fl_x.cxx:997)
==8663==    by 0x46AF6AD: do_queued_events() (Fl_x.cxx:176)
==8663==    by 0x46AF94C: fl_wait(double) (Fl_x.cxx:201)
==8663==    by 0x465DB94: Fl::wait(double) (Fl.cxx:368)
==8663==    by 0x465DC3B: Fl::check() (Fl.cxx:412)
==8663==    by 0x40E96BB: Stg::WorldGui::Load(std::string const&) (in
/usr/local/lib/libstage.so.4.1.1)
==8663==    by 0x804F51A: StageUI::createWorld(std::string) (StageUI.cpp:34)
==8663==  If you believe this happened as a result of a stack
==8663==  overflow in your program's main thread (unlikely but
==8663==  possible), you can try to increase the size of the
==8663==  main thread stack using the --main-stacksize= flag.
==8663==  The main thread stack size used in this run was 8388608.
==8663==
==8663== HEAP SUMMARY:
==8663==     in use at exit: 339,082 bytes in 883 blocks
==8663==   total heap usage: 10,055 allocs, 9,172 frees, 616,922 bytes allocated
==8663==
==8663== LEAK SUMMARY:
==8663==    definitely lost: 0 bytes in 0 blocks
==8663==    indirectly lost: 0 bytes in 0 blocks
==8663==      possibly lost: 2,352 bytes in 99 blocks
==8663==    still reachable: 336,730 bytes in 784 blocks
==8663==         suppressed: 0 bytes in 0 blocks
==8663== Rerun with --leak-check=full to see details of leaked memory
==8663==
==8663== For counts of detected and suppressed errors, rerun with: -v
==8663== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 83 from 12)
Segmentation fault



The relevant code is as follows:

Load is called in the createWorld function.

StageUI::StageUI(int numberOfRobots) {
    vector<string> robotsNames;
    robotsNames.push_back("r0");
    robots.resize(numberOfRobots);
    world = createWorld("/home/alex/Stage/worlds/simple-orig.world");
    connectToAgents(world, robotsNames);
    world->Run();
}

StageUI::~StageUI() {
}

Stg::WorldGui* StageUI::createWorld(string worldFile) {
    char *ptest[2];
    int ntest = 1;
    ptest[0] = "0";
    char **pptest = ptest;
    char ***ppptest = &pptest;
    // initialize libstage
    Stg::Init(&ntest, ppptest);

    Stg::WorldGui* world = new Stg::WorldGui(800, 700, "Evolution Training");
    world->Load(worldFile.c_str());

    return world;
}

I have this code but using World instead of WorldGui working just fine
so I really don't know what's going on.

Oh and the command "stage simple.world" works just fine.


Also can you tell me if you prefer me to put the code on a site like
pastbin where the syntax is highlighted and link to it or do you just
want a copy in the email (thinking of you guys)?

Regards

Alex Wood

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Playerstage-users mailing list
Playerstage-users@...
https://lists.sourceforge.net/lists/listinfo/playerstage-users

 « Return to Thread: WorldGui:: Load throwing a seg fault