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

Author Topic: strange problem  (Read 3894 times)

0 Members and 1 Guest are viewing this topic.

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
strange problem
« on: May 13, 2014, 12:27:54 pm »
Hey, i have problem with my map editor, i don't know why, but when i add one more object from tgui, sfml and type higher than char my app crash, only in menu class, why?, when i debug everything work fine, but when i want run exe it crash...

that print console
Quote
Process returned -1073741676 (0xC0000094)   execution time : 2.281 s
Press any key to continue.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: strange problem
« Reply #1 on: May 13, 2014, 12:29:11 pm »
Please read and apply this.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: strange problem
« Reply #2 on: May 13, 2014, 12:54:38 pm »
well, my english isn't pretty good, sorry, anyway my problem is with this class, at the moment everything work fine, but when i declare one more type upper than char (for eg. int or float) app will it crash, in debuger everything work fine too, i was tryed use pointers, but it don't work too :PP, problem can be with memory?
#ifndef MENU_H
#define MENU_H
#include <TGUI/TGUI.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include "../include/Map.h"
#define THEME_CONFIG_FILE "gui/BabyBlue.conf"

class Menu
{
    public:
        void LoadMenu(sf::RenderWindow &wnd);
        bool Callback(Map &m);
        void Event(sf::Event &event);
        void Draw();
        void hide();
        void getTile();
    protected:
    tgui::Gui gui;
    tgui::Gui tilegui;
    tgui::MenuBar::Ptr menu;
    tgui::Callback callback;
    tgui::ChildWindow::Ptr window;
    tgui::Button::Ptr Create;
    tgui::Button::Ptr Load;
    tgui::EditBox::Ptr name;
    tgui::EditBox::Ptr tilepath;
    tgui::EditBox::Ptr objectpath;
    tgui::EditBox::Ptr tilesize;
    tgui::EditBox::Ptr x;
    tgui::EditBox::Ptr y;
    sf::RenderWindow *W;
    sf::RenderWindow T;
    sf::Sprite tilespr;
    sf::Texture *tex;
    sf::Vector2i pos;
    sf::Mouse mouse;
    sf::Vector2i WinPos;
    bool showT;
    bool showM;
    Map *mapa;
};

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: strange problem
« Reply #3 on: May 13, 2014, 01:18:50 pm »
Can you show the code surrounding the location where it crashes?
Laurent Gomila - SFML developer

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: strange problem
« Reply #4 on: May 13, 2014, 01:30:22 pm »
it crash in debug mode only lol, it crash when i declare one typ
in this code everything is ok, to crash i must declare one variable... i'll try later rebuild my debug mode libs, maybe it help...
app crash at startup, it's strange, anyway i can upload my project and you can compile it and check, maybe it crashesh only on my i5 hmmm
« Last Edit: May 13, 2014, 01:34:36 pm by Soul »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: strange problem
« Reply #5 on: May 13, 2014, 01:41:41 pm »
If it randomly crashes when changing unrelated code, then you most likely have a heap/stack corruption.
What you can do, is start your debugger and check the variables for stack overflows and out of bound memory access. Minimize your code, so the issues become obvious or it's so small that you can post it here as minimal and complete code.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: strange problem
« Reply #6 on: May 13, 2014, 06:03:38 pm »
Some tools that I find often help tracking down issues like that:

Valgrind: http://valgrind.org/
Address sanitizer: http://clang.llvm.org/docs/AddressSanitizer.html
Clang Analyzer: http://clang-analyzer.llvm.org/

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: strange problem
« Reply #7 on: May 13, 2014, 06:18:16 pm »
First he should learn good C++ practices so that such errors nearly never happen and at the same time learn how to use a debugger. This is far more important than other tools.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: strange problem
« Reply #8 on: May 13, 2014, 06:34:27 pm »
I'm not disagreeing with that. But the tools are still good to know about and other people may also read the thread and find the links useful.  :)

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: strange problem
« Reply #9 on: May 14, 2014, 12:04:05 pm »
http://www44.zippyshare.com/v/1075079/file.html

here is complete my mapeditor source code, the problem is in menu.h, if you can compile it in debug mode (not debuger...)
then use  one of variables in comments and check what's wrong, my debuger can't nothing find because everything work fine

Doodlemeat

  • Guest
Re: strange problem
« Reply #10 on: May 16, 2014, 01:26:07 am »
    ///sf::RectangleShape dsadas;       this declaration will crash app
    ///int dasdas;                          or this

I can't see any include of the SFML graphics namespace.
Try to write #include <SFML/Graphics/RectangleShape.hpp>