A reckless adventure with OpenGL

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: A reckless adventure with OpenGL

#76 Post by Mitten.O »

I couldn't apply your version of the patch because of line ending trouble, but the MSVC files are irrelevant here, so it should be all good.
Any code by me in this post is released under GPL 2.0 or later.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: A reckless adventure with OpenGL

#77 Post by Geoff the Medio »


User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: A reckless adventure with OpenGL

#78 Post by Geoff the Medio »

Just got a crash when exiting the program. I started FreeOrion, went into single player galaxy exit, cancelled, went into options, set a few things like FPS limit and man rendering options, then clicked done, then exit on the main menu, and then got a crash popup. Attaching the debugger, the output says:

Code: Select all

Unhandled exception at 0x042faf2c in FreeOrion.exe: 0xC0000005: Access violation reading location 0x000007f0.
And from the stack, it looks to be something in a GL buffer, so I'm posting to this thread...

Code: Select all

>	GiGi.dll!GG::GLBufferBase::~GLBufferBase()  Line 24 + 0x1c bytes	C++
 	GiGi.dll!GG::GLTexCoordBuffer::`vector deleting destructor'()  + 0x5d bytes	C++
 	GiGi.dll!GG::Font::RenderCache::~RenderCache()  Line 647 + 0x65 bytes	C++
 	GiGi.dll!GG::TextControl::~TextControl()  Line 57 + 0x4b bytes	C++
 	GiGi.dll!GG::TextControl::`vector deleting destructor'()  + 0x43 bytes	C++
 	GiGi.dll!GG::Wnd::~Wnd()  Line 232 + 0x1a bytes	C++
 	GiGi.dll!GG::Layout::~Layout()  + 0xf3 bytes	C++
 	GiGi.dll!GG::Layout::`vector deleting destructor'()  + 0x43 bytes	C++
 	GiGi.dll!GG::Wnd::~Wnd()  Line 232 + 0x1a bytes	C++
 	GiGi.dll!GG::TextBoxBrowseInfoWnd::~TextBoxBrowseInfoWnd()  + 0xab bytes	C++
 	FreeOrion.exe!GG::TextBoxBrowseInfoWnd::`scalar deleting destructor'()  + 0xc bytes	C++
From some additional testing, it seems to be caused by going into the options screen, mousing over some text to make a popup appear (consistent with the BroseInfoWnd stuff in the stack), and then clicking done, and Exit on the main menu. I don't get a crash on exit without first making a tooltip appear by mousing over options screen text.

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: A reckless adventure with OpenGL

#79 Post by Mitten.O »

Couldn't reproduce. Found a different exit issue, though. (See other thread) How possible is it to try valgrind on windows?
Any code by me in this post is released under GPL 2.0 or later.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: A reckless adventure with OpenGL

#80 Post by Geoff the Medio »

Never tried it.

Crash also happens after going into the single player galaxy setup, hovering over some text to get a tooltip, cancelling, then exiting from the splash menu. Doesn't happen without showing a tooltip.

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: A reckless adventure with OpenGL

#81 Post by Mitten.O »

Still couldn't reproduce, but found a potential cause. TextControl isn't checking if it has a cache before deleting it. Good idea to fix that whether or not it fixes the problem.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: A reckless adventure with OpenGL

#82 Post by Geoff the Medio »

Applies and builds OK for me, and runs, but still crashes the same way.

User avatar
em3
Vacuum Dragon
Posts: 630
Joined: Sun Sep 25, 2011 2:51 pm

Re: A reckless adventure with OpenGL

#83 Post by em3 »

Deleting a NULL pointer is valid code in c++ (a no-op).
https://github.com/mmoderau
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: A reckless adventure with OpenGL

#84 Post by Geoff the Medio »

I suppose it's also notable that setting a class member variable to 0 in the destructor is pointless...

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: A reckless adventure with OpenGL

#85 Post by Mitten.O »

Not pointless. Someone may try to use a reference to the class after it has been deleted and before other data has been written to the memory. Doing things that make that easy to notice when debugging can be good. Of course, TextControl is sometimes validly in a state without the cache, which weakens that point. Perhaps a more valid view is to hate seeing a delete without a corresponding setting to 0. Some style guides enforce that.

Didn't know about null deletion being a NOP. Seems very un-c++ like to be able to deal with that. No ideas on the error, then.
Any code by me in this post is released under GPL 2.0 or later.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: A reckless adventure with OpenGL

#86 Post by Dilvish »

Mitten.O wrote:Perhaps a more valid view is to hate seeing a delete without a corresponding setting to 0.
sure, just as there are various places in the FO code where we have break statements at the end of a default case block; kind of pointless with the code exactly as it is, but just a good thing to be in the habit of doing at the end of case blocks.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: A reckless adventure with OpenGL

#87 Post by Vezzra »

Mitten.O wrote:Still couldn't reproduce, but found a potential cause. TextControl isn't checking if it has a cache before deleting it. Good idea to fix that whether or not it fixes the problem.
Has this patch been committed?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: A reckless adventure with OpenGL

#88 Post by Geoff the Medio »

Vezzra wrote:Has this patch been committed?
The above discussion was unresolved as to whether there was any benefit to the patch.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: A reckless adventure with OpenGL

#89 Post by Vezzra »

Geoff the Medio wrote:The above discussion was unresolved as to whether there was any benefit to the patch.
Well,
Mitten.O wrote:TextControl isn't checking if it has a cache before deleting it. Good idea to fix that whether or not it fixes the problem.
...this sounds like it would be a good idea to commit that patch anyway, regardless if it fixes the issue at hand or not...?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: A reckless adventure with OpenGL

#90 Post by Geoff the Medio »

Vezzra wrote:...sounds like it would be a good idea to commit that patch...
If you want, go ahead.

Post Reply