[Solved] A possible bug in QWidget::layout()
Hi guys. I’m getting access violation exception (c0000005 in QtGuid4.dll) while I try to access widget’s layout.
As you can see from image above, both tbSandboxedApps and tbHistory has vertical layout on them, but while I try to access their layout, I get the exception mentioned above.
- QLayout* ll = ui->tbHistory->layout();
This code throws the exception, but from the documentation, we can read that:
“Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed.”
So in my case, ui->tbHistory->layout() should return a valid pointer to it’s vertical layout, but instead, it crashes the app. Even if I break the layout, it still crashes instead of returning 0, as pointed by documentation.
I’m using custom MSVC build of Qt 4.7.3, without any source modification.
Any ideas what could be the problem?
My bad, I was accessing layout() until I called ui->setupUi();