-   Programming (
-   -   wxWidgets (

kornerr 10-12-2005 09:27 AM

I get "Segmentation fault" when try to do

map->skybox.back.filename = "string";
map is a pointer to Map class.
filename is of wxString class.
I can't understand what's wrong here, because when I do

map->skybox.back.texid = 1
it doesn't cause the error.
texid is of GLint type.

I even tried to change filename to string type, not wxString class, but with no success. Even memset was done for skybox...

I'm at a loss what to do, and what can cause the error :(

Can anyone help me?


PS: Sources
(remove ".doc" from the filename)
The sources require wxWidgets and OpenGL.
Call "Map->Skybox->OK" and you will get "Segmentation fault".

destuxor 10-13-2005 09:46 AM

I don't have time to take a look at the code but here's a really wild guess. You need to save a string into a char array, right? Since map->skybox.back.filename is a pointer to the first character to that array, what you need to do is add a "*" to that statement:

* map->skybox.back.filename = "string";
That's a really wild guess. If it doesn't work tell me and I'll actually RTFsource.

kornerr 10-13-2005 10:05 AM

Thanks, destuxor.

Well, I was answered at wxWidgets forum about that already :)
the problem is in memset (&skybox, 0, sizeof (skybox))
because when it's done, wxString field is destroyed (as well as string field) and this causes the error.
If it has char* (built-in type) all works ok.


All times are GMT -5. The time now is 08:34 PM.