PDA

View Full Version : ASSERTION errors in 4.7.0 file qlayoutengine_p.h



jon@tsdmedia.com
2nd October 2010, 20:02
I created a Qt (qtsdk-2010.04 (ver 4.6.3 I think)) application on my Ubuntu Linux box, it works quite nicely.

Currently I need to port the app to Windows. I am using an instance of XP SP1 running on Sun's VirtulBox, with Visual Studio 2008 installed. I installed the Qt4.7.0 sources and compiled it with VS2008 and there were no issues. I also installed the VS Qt add-in.


After a little work and massage I finally got the project to build, but when I run it I get this error:


Module: 4.7.0
File: global\qglobal.cpp
Line: 2239

ASSERT: "uniformSpacer >= 0 || spacing >= 0" in file e:\qt\4.7.0\include\qtgui\private\../../../src/gui/kernel/qlayoutengine_p.h, line 78



this is the code snippet from the file qlayoutengine_p.h:

77 int effectiveSpacer(int uniformSpacer) const {
78 Q_ASSERT(uniformSpacer >= 0 || spacing >= 0);
79 return (uniformSpacer >= 0) ? uniformSpacer : spacing;
80 }


So I am assuming that my 'QLayoutStruct.spacing' is a value less than 0. Why? I don't know.


Here is a snippet from my app:


contactsLayout = new QVBoxLayout;

contacts[nCONTACT_TYPE] = new contactWidget(nCONTACT_TYPE,this);
contacts[nBILLING_TYPE] = new contactWidget(nBILLING_TYPE,this);
contacts[nSHIPPING_TYPE] = new contactWidget(nSHIPPING_TYPE,this);

tabWidget = new QTabWidget;
--> tabWidget->addTab(contacts[nCONTACT_TYPE], tr("Contact ID")); <-- error occurs at this line of execution
tabWidget->addTab(contacts[nBILLING_TYPE], tr("Billing ID"));
tabWidget->addTab(contacts[nSHIPPING_TYPE], tr("Shipping ID"));


The current parent widget (vendorWidget) and the contactWidget are BOTH derived from the same base class.

I have almost exactly the same arrangement in another class, "employeeWidget" and "emplyeeContact" are also both derived from the same base class as the vendor widgets, and they suffer exactly the same problems.

IF I build the project minus the offending widgets the rest of the code runs as it should.

This is very similar to QTBUG-13652 which was submitted 17/Sep/10.

One last item, I also tried building the app with qmake and the MinGW tools. That version had the same issues.

Any assistance would be greatly appreciated, thank you.

Jon Aldrich

PS: Did I mention this does not happen at all in the Linux environment ;-)

RazZziel
8th December 2010, 18:22
Did you ever find a solution to this problem? I'm finding exactly the same error, but I can't debug it properly, because as soon as I run the application through mingw-gdb, it receives an unknown exception on QSettings::setPath()...

Added after 59 minutes:

Hm, using debug()s I managed to locate the problem... sort of. In a specific form layout, if I enter only one row, everything goes well, but if I add the label of the second row, it breaks. However, if I move the whole form layout somewhere else, it works. What the?

Finally I fixed it selecting the stacked widget my form was on, and making it use a vertical layout instead of a grid layout.

Oh well. What a fun evening indeed.