December 24, 2011

Davita Davita
Lab Rat
76 posts

[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.
http://dl.dropbox.com/u/3055964/Capture.GIF
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.

  1. 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?
Thanks.

UPDATE
________________
My bad, I was accessing layout() until I called ui->setupUi();
:shame: :)

3 replies

December 25, 2011

Volker Volker
Ant Farmer
5428 posts

So it’s solved, I’d guess?

December 25, 2011

Davita Davita
Lab Rat
76 posts

Yes Volker, thanks. I forgot to rename the thread. :)

December 25, 2011

Volker Volker
Ant Farmer
5428 posts

No problem, I just wanted to be sure :)

 
  ‹‹ How to get another process window handle using qt      DOESN"T WORK D-Bus Remote Controlled Car Example ››

You must log in to post a reply. Not a member yet? Register here!