Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8684

Useless Q_ASSERT in dialogs/qprintdialog

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.6.0, 4.6.1, 4.6.2
    • None
    • 6d6df0e2b63f0103ec1f19b4b856b106e295d618

    Description

      Problem:
      When QPrintDialog has no parent visible or has no parent + is a top widget, it returns a Q_ASSERT error in debug mode when exec(). (It shouldn't even so QPrintDialog being a top level widget with no parent is not the expected behavior)

      Code to reproduce:
      #include <QtGui>

      int main(int argc, char** argv)
      {
      QApplication application(argc, argv);

      QPrintDialog print_dialog;
      print_dialog.exec();

      return 0;
      }

      Suggested patch:
      diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog
      _win.cpp
      index 12edf7c..4cf274c 100644
      — a/src/gui/dialogs/qprintdialog_win.cpp
      +++ b/src/gui/dialogs/qprintdialog_win.cpp
      @@ -138,7 +138,7 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget
      *parent,

      if (d->ep->printToFile)
      pd->Flags |= PD_PRINTTOFILE;

      • Q_ASSERT(parent != 0 && parent->testAttribute(Qt::WA_WState_Created));
        + //Q_ASSERT(parent != 0 && parent->testAttribute(Qt::WA_WState_Created));
        pd->hwndOwner = parent->window()->winId();
        pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage());
        pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(),
        pdlg->maxPage()) : 1;

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes