GLGraphicsView bug?

Hello,

I was trying to port the Nifskope tool (tool to open/edit NIF 3D model written in Qt C++) to Haiku and I’ve noticed the app is crashing when the GLGraphicsView was using the setViewport() method.

Removing the setViewport() by a comment in the source is making the app running really good on Haiku (good performance on the 3D display), however the display of the rendering scene is on the top left of the screen instead on the right (in order to display additional information on the left).

As I didn’t touch to the sources and as the program is running fine on other platforms (Win/Linux/MacOS), I was wondering if there’s a bug somewhere on the setViewPort() on Haiku ?

I’ve tried to debug the source regarding this QT OpenGL method, however I’ve not been able to do that easily for the moment.

Any idea on how to proceed ?

Current program running fine but with a bad position of the rendering :

Expected (I’ve made some edition with KolourPaint to reproduce the good rendering:) ) :

1 Like

Ok moving forward on that topic, I noticed the QHaikuWindow->setParent() is raising a segmentation fault as per screenshot below :

On other platforms (Win/Linux/MacOS), I don’t have such issue, so my guess is that it’s Haiku related.

In the code the “ogl” variable is containing an QGLWidget just after the GLView::create().
The part which is raising the segmentation fault is the graphicsView->setViewport(ogl)

Any idea how to identify what’s wrong in the QHaikuWindow->setParent() ?

Can you show me the QHaikuWindow::setParent() code you’re using?

Assuming this code is what you’re using (not sure):

void QHaikuWindow::setParent(const QPlatformWindow *win)
{
	if (m_parent != (QHaikuWindow*)win) {
		m_parent = (QHaikuWindow*)win;
		m_topLevel = (QHaikuWindow*)win;
		QHaikuWindow *topWin = ((QHaikuWindow*)win)->topLevelWindow();
		if (!topWin->fakeChildList()->contains(this))
			topWin->fakeChildList()->append(this);
	}
}

I would say the problem is

m_topLevel = (QHaikuWindow*)win;

is NULL, thus it is also NULL on the next line when it casts win to QHaikuWindow* again. and then it tries to call a NULL pointer and crashes.

… and the window is probably NULL because the view has not yet been added to the window as the code expects to be. Best guess.

Nice catch !

I’ve moved the line " graphicsView->setViewport( ogl);" a bit later in the UI init part and now the view is rendered fine as per below :slight_smile:

Next step is to try to produce the corresponding receipe for HaikuPorts…

I’ve already read the wiki on haikuports/haikuporters, but I will need a bit of practice before being able to produce the package.

Thanks!

1 Like