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

QPrintDialog does not work on MacOSX - static build

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.1.0
    • Core: Plugins
    • None
    • Mac OS X AMD 64 - latest code from GIT
    • macOS

    Description

      Hi,

      Calling the print dialog when statically linking the QT libraries leads to a crash, because of some failed NULL pointer checks. The reason is that the cocoa printing support plugin does not get loaded correctly. The following hack makes it work again:

      diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp
      index ce6d7a0..cbcd228 100644
      — a/src/printsupport/kernel/qplatformprintplugin.cpp
      +++ b/src/printsupport/kernel/qplatformprintplugin.cpp
      @@ -45,9 +45,11 @@
      QT_BEGIN_NAMESPACE

      #ifndef QT_NO_LIBRARY
      +#if 0
      Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
      (QPlatformPrinterSupportFactoryInterface_iid, QLatin1String("/printsupport"), Qt::CaseInsensitive))
      #endif
      +#endif

      QPlatformPrinterSupportPlugin::QPlatformPrinterSupportPlugin(QObject *parent)
      : QObject(parent)
      @@ -66,13 +68,19 @@ QPlatformPrinterSupportPlugin::~QPlatformPrinterSupportPlugin()
      application exit, i.e. you can expect this pointer to always be valid and
      multiple calls to this function will always return the same pointer.
      */
      +
      +#include <../plugins/platforms/cocoa/qcocoaprintersupport.h>
      QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get()
      {
      static QPlatformPrinterSupport *singleton = 0;
      if (!singleton)

      { +#if 0 const QMultiMap<int, QString> keyMap = loader()->keyMap(); if (!keyMap.isEmpty()) singleton = qLoadPlugin<QPlatformPrinterSupport, QPlatformPrinterSupportPlugin>(loader(), keyMap.constBegin().value()); +#else + singleton = new QCocoaPrinterSupport(); +#endif }

      return singleton;
      }

      Thank you!

      --HPS

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            hps HPS
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes