SFML community forums

Help => Graphics => Topic started by: fixus971 on October 06, 2008, 12:06:12 am

Title: svn: sf::String sfs -> Access violation
Post by: fixus971 on October 06, 2008, 12:06:12 am
error:
Access violation reading location 0x00000000

in:
Context.cpp of SFML SVN compiled with VS9 C++

at:
Code: [Select]
void Context::SetActive(bool Active)
{
    myDummyWindow->SetActive(Active);
}


where:
in my program and in SFML samples too.

to try:
simply put variable definition "sf::String sfs;" before main()

I need it to share same String settings in many files of my program.
Title: svn: sf::String sfs -> Access violation
Post by: Laurent on October 06, 2008, 07:51:50 am
I'll check this as soon as possible, thanks for your feedback.
Title: svn: sf::String sfs -> Access violation
Post by: SirJulio on October 06, 2008, 01:15:57 pm
Just ckecked with 895, DLL build, and no such problem.

Did you use static or dynamic linking ?
Title: svn: sf::String sfs -> Access violation
Post by: Laurent on October 06, 2008, 02:18:09 pm
Don't try to reproduce it ;)
The problem is probably that his global sf::String is constructed before the global sf::Context, as the order of initialization of globals is undefined across compile units.

I'll fix it with an explicit function call to get the context (in internal code), so that it's always created when someone needs it.
Title: svn: sf::String sfs -> Access violation
Post by: fixus971 on October 06, 2008, 04:42:18 pm
Thaks SirJulio & Laurent.

I found same problem trying with static variable in class but declaration remain out in .cpp and get same problem.

I solve my problem coping String initialization instructions in all 4 files/class.

So isn't simple share same Font on many class. (for now I'm ok)

Thanks
Title: svn: sf::String sfs -> Access violation
Post by: Laurent on October 09, 2008, 09:08:25 pm
I've made a fix ; maybe you can try the latest revision with your global variables and make sure it works now :)
Title: svn: sf::String sfs -> Access violation
Post by: fixus971 on October 09, 2008, 10:15:11 pm
Wow Great Laurent. I-ll check as soon as possible. Thanks
Title: svn: sf::String sfs -> Access violation
Post by: fixus971 on October 09, 2008, 11:27:17 pm
:oops: Sorry but I get only a small change..

Now Program don't halt on variable definition on XP SP2

But still halt on
Code: [Select]
App.Create(Mode, "Test", sf::Style::Close);
Same assembler error.. only different address.

Otherwise on Win2000 halt again on variable definition..
I try to install MS VS C++ on it but Setup said me that I can't install it on Win2000.
Title: svn: sf::String sfs -> Access violation
Post by: Laurent on October 10, 2008, 07:49:39 am
Can you give a complete minimal example which reproduces the problem ?
Title: svn: sf::String sfs -> Access violation
Post by: fixus971 on October 10, 2008, 11:16:44 am
Sorry..
I mixed this forum topic with a similar one:
http://www.sfml-dev.org/forum/viewtopic.php?t=676&postdays=0&postorder=asc&start=0

I mixed that 2 post because I get similar error when use a sample mini  code(in above post) compiled as Release on other PC where I haven't compiler.

Now I retested with previous code that give me problem of this topic, recompiled all as default and see that now all go OK! ..on Developer PC.
Thanks
Title: svn: sf::String sfs -> Access violation
Post by: Laurent on October 10, 2008, 11:48:50 am
Ah, I prefer that ;)