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

Author Topic: 0xC0000005 when drawing drawable  (Read 2294 times)

0 Members and 2 Guests are viewing this topic.

denis318

  • Newbie
  • *
  • Posts: 7
    • View Profile
0xC0000005 when drawing drawable
« on: September 17, 2017, 01:41:18 pm »
I have a function AddSprite(Drawable*, unsigned short), that adding Drawable to 2d vector with given layer number(as two parametr)
Its works perfectly, but when i added MapLoader ( its a fallahn`s sfml-tmxloader  MapLoader that extends Drawable) to 0 layer and rendered it, i got 0xC0000005 error, i checked my layers numbers, all fine, map being loaded, i dont think what is wrong, my code below
Quote
tmx::MapLoader map("resources/");
         map.addSearchPath("resources/blocks/");
         
            if (map.load("map.tmx"))
            {
               if (debug) {
                  cout << "map loaded!" << endl;
               }
            }
            else
            {
               if (debug) {
                  cout << "MAP NOT LOADED!" << endl;
               }
            }
            engine->AddSprite(&map, 0);
         //
my rendering code:
Quote
inline void Engine::render()
   {
      while (window.isOpen())
      {
         window.clear();
         for (unsigned int i = 0; i < Engine::layerr.size(); i++)
         {
            for (unsigned int i1 = 0; i1 < Engine::layerr.at(i).size(); i1++)
            {
                  window.draw(*(Engine::layerr.at(i).at(i1)));
            }
         }
         window.display();
      }
   }
(i using multithread rendering, so rendering occurs in another detached thread)
my vector looks like this:
Quote
vector<vector<Drawable*>> layerr
its haves size 1, but i drawing to layer 0(first) and layers being initialized by:
Quote
void Engine::AddLayer(unsigned short layernum)
   {
      vector<Drawable*> tempvector;
      Engine::layerr.push_back(tempvector);
   }
sfml-tmxloader https://github.com/fallahn/sfml-tmxloader is last version
SFML is 2.4.2
Tiled version is 2017.05.26
с++ version is 17 (2017) and visual studio same 2017
i using static SFML,static zlib,x64 architecture and static TMX (TMX_STATIC flag)
sorry for my bad english
Please anybody help me, i dont known what is wrong :(
my map with tsx and textures in archive attached below
« Last Edit: September 17, 2017, 01:48:59 pm by denis318 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: 0xC0000005 when drawing drawable
« Reply #1 on: September 17, 2017, 02:16:10 pm »
So when it crashes, what's the call stack?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

denis318

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 0xC0000005 when drawing drawable
« Reply #2 on: September 17, 2017, 04:53:16 pm »
This stack trace? (Russia language)
(click to show/hide)
also now it crashes with error 0x00007FFEFD0334BE (ucrtbase.dll) and showing this lines in MapLoaderPrivate.cpp
(idk what)
Quote
for(auto& layer : m_layers)
      rt.draw(layer);
sorry if it wrong call stack, i dont know completly what is it

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: 0xC0000005 when drawing drawable
« Reply #3 on: September 17, 2017, 05:07:09 pm »
When it crashes can you check what the layer contains, i.e. whether it's valid?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

denis318

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 0xC0000005 when drawing drawable
« Reply #4 on: September 17, 2017, 05:37:24 pm »
If i understood right, layer 0 size is 1 when crashing (ie it contains map Drawable in it,so that valid i think)
(my layer, not TMX)
« Last Edit: September 17, 2017, 06:15:37 pm by denis318 »

denis318

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 0xC0000005 when drawing drawable
« Reply #5 on: September 19, 2017, 03:45:28 pm »
Oh, after many tests, i solved it.
Programm was crashing because tmx::MapLoader must be drawn in thread when it created, i created support boolean gamestarted and now creating a map in Engine class, that contains method to rendering.
Or its was because my map was local,
most likely the second
« Last Edit: September 23, 2017, 04:23:02 pm by denis318 »

 

anything