Errors From Updating to 7.1
« on: 27 October 2016, 07:03:35 »
So due to some issues with SFML 2.2 I went ahead and kicked up to TGUI 7.1 and SFML 2.4. Boy was updating from ::create to make_shared annoying. Also had to change all the tool tip crap.

Now I have a lot of problems with creating new objects.

Code: [Select]
mainMenuPanel = std::make_shared<tgui::Panel>();
That line which apparently is required to replace the old ::create function in 7.0 causes a segfault in this code:
Code: [Select]
/**
   *  @brief  Create an object that is owned by a shared_ptr.
   *  @param  __args  Arguments for the @a _Tp object's constructor.
   *  @return A shared_ptr that owns the newly created object.
   *  @throw  std::bad_alloc, or an exception thrown from the
   *          constructor of @a _Tp.
   */
  template<typename _Tp, typename... _Args>
    inline shared_ptr<_Tp>
    make_shared(_Args&&... __args)
    {
      typedef typename std::remove_const<_Tp>::type _Tp_nc;
      return std::allocate_shared<_Tp>(std::allocator<_Tp_nc>(),
       std::forward<_Args>(__args)...);
    }

I copied it exactly from the example code, which is where I figured out that ::create wasn't working in the first place. Do you have any idea why its doing that?

Also making a Tabs that way seemed to work.
« Last Edit: 27 October 2016, 07:07:55 by MoLAoS »

*

texus

  • *****
  • 1163
    • View Profile
    • Texus's Blog
Re: Errors From Updating to 7.1
« Reply #1 on: 27 October 2016, 12:42:09 »
The make_shared function shouldn't crash, it just creates an object. It would mean that the following code would crash as well:
tgui::Panel panel;

TGUI 0.7-dev stopped using the create function over a year ago already (while 0.7.0 was only released april this year) so you are updating from a rather old version. I actually reintroduced these create functions in 0.8-dev after I realized they were nicer to work with, but if you would start using that version then you would have similar kind of issues next year.

Is the example code itself crashing? If not, could you provide a minimal code example that does crash?

Re: Errors From Updating to 7.1
« Reply #2 on: 27 October 2016, 14:29:16 »
The make_shared function shouldn't crash, it just creates an object. It would mean that the following code would crash as well:
tgui::Panel panel;

TGUI 0.7-dev stopped using the create function over a year ago already (while 0.7.0 was only released april this year) so you are updating from a rather old version. I actually reintroduced these create functions in 0.8-dev after I realized they were nicer to work with, but if you would start using that version then you would have similar kind of issues next year.

Is the example code itself crashing? If not, could you provide a minimal code example that does crash?
tgui::Panel panel does appear to crash, though Tab worked apparently. I think the issues may all be from using the pre-compiled stuff. I may just have to build SFML/TGUI myself to avoid these issues.

*

texus

  • *****
  • 1163
    • View Profile
    • Texus's Blog
Re: Errors From Updating to 7.1
« Reply #3 on: 27 October 2016, 14:36:47 »
It doesn't crash here so maybe rebuilding is the best thing to do.
What compiler were you using btw? Where both SFML and TGUI downloaded for that exact compiler?
« Last Edit: 27 October 2016, 18:22:36 by texus »

Re: Errors From Updating to 7.1
« Reply #4 on: 28 October 2016, 03:57:05 »
After a slight issue where I had to find and replace tool tips with the make_shared thing due to a crazy error that stacked traced the initial error to a place that made no god damn sense that I used std::cout to find the real source of I am now in business.

As far as I know TGUI and SFML are now properly integrated in the latest proper version barring 0.8 dev.

Now I just have to resolve the SFML vram issue that caused me to try and upgrade in the first place. FML.