Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » OpenGL demo resulting in Fatal error, Heap leaks detected! error...
OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48357] Mon, 26 June 2017 05:03 Go to next message
ptkacz is currently offline  ptkacz
Messages: 88
Registered: March 2017
Member
Hi Guys,

Upon bringing up TheIDE, I launch the OpenGL demo from the reference section.

Upon compiling the running the program, the program is launched followed by window popping up with the following message:

Fatal error
Heap leaks detected!

Upon selecting the, "okay" button, all windows are closed.


The issue appears to be happening on the win.Open():

GUI_APP_MAIN
{
	Ctrl::GlobalBackPaint();
	TopWindow win;
	OpenGLExample gl;
	gl.SetFrame(InsetFrame());
	win.Add(gl.HSizePos(10, 10).VSizePos(10, 10));
	win.Sizeable().Zoomable();
    win.Open();
	// win.Run();
}


Anyone have some code that works demoing a simple OpenGL program?


Peter
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48376 is a reply to message #48357] Mon, 26 June 2017 16:57 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 798
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello,

Please check following fix: http://ultimatepp.org/redmine/issues/1481 and let me know it helps to you. Please modify your internal upp code according to the diff posted on the page (attachment).

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48381 is a reply to message #48357] Tue, 27 June 2017 03:05 Go to previous messageGo to next message
ptkacz is currently offline  ptkacz
Messages: 88
Registered: March 2017
Member
Hi Klugier,

Thanks for the reply. Just curious, the line:

+ if(backpaint == FULLBACKPAINT || globalbackpaint && !hasdhctrl && !dynamic_cast<DHCtrl *>(this)*/) {

the "*/" before the closing parentheses appears to be at the end of a comment block?


So when I've completed the changes, then I just, "make" followed by a "make install"?

I'm guessing that this fix is currently in the current nightly build?

When's 2017.2 targeted for by the way?


Peter
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48382 is a reply to message #48381] Tue, 27 June 2017 12:48 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 798
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello,

Please remove '/*' from the if statement and let me know it works. This patch is not included in nightly builds, so you need to apply it manually. I will need to talk with Mirek why this line is commented. It causes bad regression in OpenGL.

Please be careful with OpenGL it can works unstable in latest upp stable release.

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48389 is a reply to message #48357] Thu, 29 June 2017 05:13 Go to previous messageGo to next message
ptkacz is currently offline  ptkacz
Messages: 88
Registered: March 2017
Member
Hi Klugier,

Just thinking that each copy of U++ should come with a AMD Threadripper!

I did a complete fresh install. Also before running make, I made the changes as recommended (below). The changes had no impact and the same error was encountered.



Peter

void Ctrl::UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint)
{
	GuiLock __;
	LTIMING("UpdateArea");
	LLOG("========== UPDATE AREA " << UPP::Name(this) << " ==========");
	// ExcludeDHCtrls(draw, GetRect().GetSize(), clip);
	if(globalbackbuffer) {
		CtrlPaint(draw, clip);
		LLOG("========== END (TARGET IS BACKBUFFER)");
		return;
	}
           // if(backpaint == FULLBACKPAINT || globalbackpaint/* && !hasdhctrl && !dynamic_cast<DHCtrl *>(this)*/) {
	   if(backpaint == FULLBACKPAINT || globalbackpaint && !hasdhctrl && !dynamic_cast<DHCtrl *>(this)) {
		ShowRepaintRect(draw, clip, LtRed());
		BackDraw bw;
		bw.Create(draw, clip.GetSize());
		bw.Offset(-clip.TopLeft());
		bw.SetPaintingDraw(draw, clip.TopLeft());
		CtrlPaint(bw, clip);
		bw.Put(draw, clip.TopLeft());
		LLOG("========== END (FULLBACKPAINT)");
		return;
	}

[Updated on: Thu, 29 June 2017 05:13]

Report message to a moderator

Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48390 is a reply to message #48389] Thu, 29 June 2017 12:07 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 798
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello,

OK - I will check this problem. Please give me an information about your operating system setup, maybe this is the bug related to the Windows implementation. I was tested OpenGL with patch on Linux and it worked fine.

Also, please check compiling the OpenGL example using release mode instead of debug. It should silence "Heap leaks" error detection.

Can you explain to me - what do you have on mind when writing that "U++ should come with a AMD Threadrippe"?

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48394 is a reply to message #48390] Fri, 30 June 2017 03:28 Go to previous messageGo to next message
ptkacz is currently offline  ptkacz
Messages: 88
Registered: March 2017
Member
Regarding the AMD Threadripper, just some humor. I was thinking how much faster U++ would compile with one of those new processors.

As of operating system, I am making use of the following:

Linux Mint 18.1 Cinnamon 64 bit
Cinnamon Version 3.2.7
Linux Kernel 4.4.0-53-generic

I ran GDB against the program as was able to retrieve the following information:
(gdb) run
Starting program: /home/ptkacz/upp.out/reference/GCC.Debug.Debug_Full.Gui.Shared/GLDrawDemo 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffea54c700 (LWP 5026)]
[New Thread 0x7fffe9d4b700 (LWP 5027)]
The program 'GLDrawDemo' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 3534 error_code 2 request_code 154 minor_code 3)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
/usr/bin/xmessage

Thread 1 "GLDrawDemo" received signal SIGSEGV, Segmentation fault.
0x00000000005636bb in Upp::Ctrl::PanicMsgBox (title=0x7a91be "Fatal error", text=0x7b2b7f "Heap leaks detected!")
    at //home/ptkacz/upp/uppsrc/CtrlCore/GtkApp.cpp:56
56		__BREAK__;
(gdb) list
51			GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
52			                                           GTK_BUTTONS_CLOSE, "%s: %s", title, text);
53			gtk_dialog_run(GTK_DIALOG (dialog));
54			gtk_widget_destroy(dialog);
55		}
56		__BREAK__;
57	}
58	
59	void InitGtkApp(int argc, char **argv, const char **envptr)
60	{
(gdb) 


Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48396 is a reply to message #48394] Fri, 30 June 2017 13:46 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 798
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello,

GTK backend supports OpenGL in very limited way - the main reason why it happens is lack of DHCtrl. The easiest fix for now is to re-switch to X11 backed (Just add this flag to your main package flags) and compile. Please notice that you will still need my patch to make this working.

I will check what is wrong there - at least it shouldn't crash Smile The DHCtrl is hard to developer in GTK enviroment, but if we want to fully support OpenGL in this enviroment it is must have.

If you have any idea ant time to to fix our problems - the patch is welcome Wink

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48491 is a reply to message #48396] Sun, 09 July 2017 21:31 Go to previous messageGo to next message
ptkacz is currently offline  ptkacz
Messages: 88
Registered: March 2017
Member
Where does one specify the DHCtrl flag?
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48492 is a reply to message #48491] Sun, 09 July 2017 23:06 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 798
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello,

This is not DHCtrl flag - this is the back-end settings. Currently the default for POSIX like system is GTK. We need to change that using main package flag. You need to achieve the following result in the IDE:
index.php?t=getfile&id=5335&private=0

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48494 is a reply to message #48357] Mon, 10 July 2017 05:16 Go to previous messageGo to next message
ptkacz is currently offline  ptkacz
Messages: 88
Registered: March 2017
Member
That seems pretty easy, but when I bring up the GLDrawDemo project, the only option that displays within the drop-down is, "GUI". Not other options list to select from.

When I click on the listed "GUI" option, a Main package configuration(s) dialog window lists with, GUI listing under the Flags heading. Appending a row the the list, and selecting the right selection triangle, a Configurations flags dialog window displays (see screen shot below).

How come the GUI X11 option didn't list for this project? How do I go about adding it, so that the project is correctly built?


index.php?t=getfile&id=5336&private=0
Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48495 is a reply to message #48494] Mon, 10 July 2017 07:55 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 799
Registered: August 2007
Contributor
Hello ptkacz,

For GUI, select GUI from the "App style" options.
For X11, simply select the NOGTK option.
For any other -custom- flag you'd like to activate, you can type it into "Other flags" section,
For example, you can explicity specify X11 flag (instead of using NOGTK option) by typing X11 into "Other flags" section too.

Best regards,
Oblivion


[Updated on: Mon, 10 July 2017 08:03]

Report message to a moderator

Re: OpenGL demo resulting in Fatal error, Heap leaks detected! error... [message #48505 is a reply to message #48357] Tue, 11 July 2017 04:47 Go to previous message
ptkacz is currently offline  ptkacz
Messages: 88
Registered: March 2017
Member
Thanks Guys!

That worked, selecting App Style to GUI and checking the NOGTK check box! Now displayed selected in the place of GUI within the drop-down is, GUI.NOGTK. Here's what resulted when the program compiled and ran:

index.php?t=getfile&id=5337&private=0


I just went and tried the FTGL_Demo and that worked too!


Peter

[Updated on: Tue, 11 July 2017 04:49]

Report message to a moderator

Previous Topic: Getting the width of a layout?
Next Topic: gcc 4.4 compatible version?
Goto Forum:
  


Current Time: Sat Dec 05 00:13:45 CET 2020

Total time taken to generate the page: 0.01474 seconds