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 » U++ Library support » U++ Library : Other (not classified elsewhere) » A (maybe) bug in GLControl (on Ubuntu)
A (maybe) bug in GLControl (on Ubuntu) [message #12162] Sun, 14 October 2007 22:26 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Following the example of making an app with more than one topwindow, i changed the Opengl example in reference like this :
GUI_APP_MAIN
{
	MyAppWindow *win, *win2;
	win = new MyAppWindow;
	win2 = new MyAppWindow;
	OpenGLExample gl, gl2;
	gl.SetFrame(InsetFrame());
	gl2.SetFrame(InsetFrame());
	win->Add(gl.HSizePos(10, 10).VSizePos(10, 10));
	win2->Add(gl2.HSizePos(10, 10).VSizePos(10, 10));
	win->Sizeable().Zoomable();
	win2->Sizeable().Zoomable();
	win->OpenMain();
	win2->OpenMain();
    Ctrl::EventLoop();
}


That works, but hangs on window closing. It even hangs the debugger so I've to kill the process.
Investigating a bit more, I've seen that the destructor for GLControl NEVER get called. If I change the code like that :
GUI_APP_MAIN
{
	MyAppWindow *win, *win2;
	win = new MyAppWindow;
	win2 = new MyAppWindow;
	OpenGLExample gl, gl2;
	gl.SetFrame(InsetFrame());
	gl2.SetFrame(InsetFrame());
//	win->Add(gl.HSizePos(10, 10).VSizePos(10, 10));
//	win2->Add(gl2.HSizePos(10, 10).VSizePos(10, 10));
	win->Sizeable().Zoomable();
	win2->Sizeable().Zoomable();
	win->OpenMain();
	win2->OpenMain();
    Ctrl::EventLoop();
}

It works (without opengl window on screen, of course) and destructors are called as expected.
It seems that in former code the event loop still runs on closed windows.
I've the feeling that closing the windows don't detach the child OpenGLExample controls inside, but I'm not sure about it.
If OpenGLExample control is not derived from GLControl all goes ok.

Ciao

Max

EDIT : It seems to stay in EventLoop because of
           GetTopCtrls().GetCount()

returning 1 even when last top window is closed.

[Updated on: Sun, 14 October 2007 23:49]

Report message to a moderator

Re: A (maybe) bug in GLControl (on Ubuntu) [message #12198 is a reply to message #12162] Wed, 17 October 2007 19:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mdelfede wrote on Sun, 14 October 2007 16:26

Following the example of making an app with more than one topwindow, i changed the Opengl example in reference like this :
GUI_APP_MAIN
{
	MyAppWindow *win, *win2;
	win = new MyAppWindow;
	win2 = new MyAppWindow;
	OpenGLExample gl, gl2;
	gl.SetFrame(InsetFrame());
	gl2.SetFrame(InsetFrame());
	win->Add(gl.HSizePos(10, 10).VSizePos(10, 10));
	win2->Add(gl2.HSizePos(10, 10).VSizePos(10, 10));
	win->Sizeable().Zoomable();
	win2->Sizeable().Zoomable();
	win->OpenMain();
	win2->OpenMain();
    Ctrl::EventLoop();
}


That works, but hangs on window closing. It even hangs the debugger so I've to kill the process.
Investigating a bit more, I've seen that the destructor for GLControl NEVER get called.



Do you "delete" the window somewhere?

Mirek
Re: A (maybe) bug in GLControl (on Ubuntu) [message #12208 is a reply to message #12198] Thu, 18 October 2007 12:29 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Wed, 17 October 2007 19:05



Do you "delete" the window somewhere?




Of course, as in example, in MyAppWindow destructor....
At first I tried also to delete it at the end, but that of course doesn't work because of eventloop still running.

As I said, if the control is NOT derived from GLCtrl, all that works. I think that's something missing on GLCtrl class, but I had no time to investigate it more in depth.
Or, maybe, something missing in core classes when a control is built with a window handler as in GLCtrl.

Ciao

Max
Re: A (maybe) bug in GLControl (on Ubuntu) [message #12209 is a reply to message #12208] Thu, 18 October 2007 14:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mdelfede wrote on Thu, 18 October 2007 06:29

luzr wrote on Wed, 17 October 2007 19:05



Do you "delete" the window somewhere?




Of course, as in example, in MyAppWindow destructor....
At first I tried also to delete it at the end, but that of course doesn't work because of eventloop still running.

As I said, if the control is NOT derived from GLCtrl, all that works. I think that's something missing on GLCtrl class, but I had no time to investigate it more in depth.
Or, maybe, something missing in core classes when a control is built with a window handler as in GLCtrl.

Ciao

Max




Hm, do you think you could post the complete package (to save the time recreating the testcase....)?

Mirek
Re: A (maybe) bug in GLControl (on Ubuntu) [message #12211 is a reply to message #12209] Thu, 18 October 2007 15:06 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Thu, 18 October 2007 14:37



Hm, do you think you could post the complete package (to save the time recreating the testcase....)?



Of course, here is it.
But it's really simple, It's a copy of the tutorial's example with multiple main windows combined with the OpenGL example.
Pay attention, I modified on-the-fly the OpenGL example, so it has the same name of the original Opengl reference package... I'm not at home so I have not the original package.
But this one behaves exactly the same.

Ciao

Max
  • Attachment: OpenGL.zip
    (Size: 3.56KB, Downloaded 280 times)
Re: A (maybe) bug in GLControl (on Ubuntu) [message #12260 is a reply to message #12211] Mon, 22 October 2007 12:38 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Some news about this ?
Re: A (maybe) bug in GLControl (on Ubuntu) [message #12374 is a reply to message #12260] Fri, 26 October 2007 20:51 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Well, investigating a bit more, I've seen that if control is derived from GLControl, the GetTopCtrls().GetCount() still returns 2 controls (in my example with 2 windows...) even on window close, so the Ctrl::EventLoop() never returns.

I'll try to investigate a bit more this bug....

Ciao

Max
[SOLVED] A (maybe) bug in GLControl (on Ubuntu) [message #12404 is a reply to message #12162] Sat, 27 October 2007 20:47 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Well, at the end, I found a solution for that.
The GLCtrl::State() function must be extended with a call of CloseGL() on CLOSE state :
void GLCtrl::State(int reason)
{
	if( InitializationProblem )
		return;
	
	if( IsInitialized )
	{
		switch( reason )
		{
			case SHOW: 
			{
				if( IsShown() && !IsMapped )
					MapWindow();

				if( !IsShown() && IsMapped )
					UnMapWindow();
			}; break;
			
			case LAYOUTPOS:
			{
				MoveSubWindow();
				OpenGLResize();
			}; break;

added-->
			
			case CLOSE:
			{
				CloseGL();
			}; break;

<--added
			
			default:
				break;
		}
	}
	else
		if( GetTopWindow() && GetTopWindow()->GetWindow() )
			OpenGL();
}


Whith this change, the list of top controls is updated correctly closing windows that contains GLControl.

Ciao

Max
Re: [SOLVED] A (maybe) bug in GLControl (on Ubuntu) [message #12405 is a reply to message #12404] Sat, 27 October 2007 21:20 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, patch applied.

Mirek
Previous Topic: Layout, fonts, MS Windows, and changing DPIs...
Next Topic: How to make my package?
Goto Forum:
  


Current Time: Thu Mar 28 20:35:23 CET 2024

Total time taken to generate the page: 0.01417 seconds