Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[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.
    @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: :)



  • So it's solved, I'd guess?



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



  • No problem, I just wanted to be sure :)


Log in to reply