Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: svn: sf::String sfs -> Access violation  (Read 4959 times)

0 Members and 1 Guest are viewing this topic.

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
svn: sf::String sfs -> Access violation
« 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.
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
svn: sf::String sfs -> Access violation
« Reply #1 on: October 06, 2008, 07:51:50 am »
I'll check this as soon as possible, thanks for your feedback.
Laurent Gomila - SFML developer

SirJulio

  • Full Member
  • ***
  • Posts: 241
    • View Profile
svn: sf::String sfs -> Access violation
« Reply #2 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 ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
svn: sf::String sfs -> Access violation
« Reply #3 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.
Laurent Gomila - SFML developer

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
svn: sf::String sfs -> Access violation
« Reply #4 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
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
svn: sf::String sfs -> Access violation
« Reply #5 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 :)
Laurent Gomila - SFML developer

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
svn: sf::String sfs -> Access violation
« Reply #6 on: October 09, 2008, 10:15:11 pm »
Wow Great Laurent. I-ll check as soon as possible. Thanks
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
svn: sf::String sfs -> Access violation
« Reply #7 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.
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
svn: sf::String sfs -> Access violation
« Reply #8 on: October 10, 2008, 07:49:39 am »
Can you give a complete minimal example which reproduces the problem ?
Laurent Gomila - SFML developer

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
svn: sf::String sfs -> Access violation
« Reply #9 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
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
svn: sf::String sfs -> Access violation
« Reply #10 on: October 10, 2008, 11:48:50 am »
Ah, I prefer that ;)
Laurent Gomila - SFML developer

 

anything