Skip to content

Commit

Permalink
Fix creation of QMacPasteboardMime classes.
Browse files Browse the repository at this point in the history
- Move the instantiation of the classes to *after* the creation of
  QGuiApplication.
  • Loading branch information
rygwdn committed Jun 5, 2014
1 parent d934ed7 commit a78292c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/platform/mac/macplatform.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@
class ClipboardApplication : public QApplication
{
public:
static QApplication *create(int &argc, char **argv)
{
// Only try to create pasteboardMimes once, and only try if we have a native interface,
// otherwise everything breaks when QPasteboardMime tries to resove some native functions.
if (QGuiApplication::platformNativeInterface())
return new ClipboardApplication(argc, argv);

return new QApplication(argc, argv);
}

private:
ClipboardApplication(int &argc, char **argv)
: QApplication(argc, argv)
, m_pasteboardMime()
Expand All @@ -57,6 +46,7 @@
{
}

private:
CopyQPasteboardMime m_pasteboardMime;
UrlPasteboardMime m_pasteboardMimeUrl;
UrlPasteboardMime m_pasteboardMimeFileUrl;
Expand Down Expand Up @@ -159,15 +149,18 @@ PlatformPtr createPlatformNativeInterface()
QApplication *MacPlatform::createServerApplication(int &argc, char **argv)
{
MacActivity activity(MacActivity::Background, "CopyQ Server");
QApplication *app = ClipboardApplication::create(argc, argv);
QApplication *app = new ClipboardApplication(argc, argv);

// Switch the app to foreground when in foreground
ForegroundBackgroundFilter::installFilter(app);

return app;
}

QApplication *MacPlatform::createMonitorApplication(int &argc, char **argv)
{
MacActivity activity(MacActivity::Background, "CopyQ clipboard monitor");
return ClipboardApplication::create(argc, argv);
return new ClipboardApplication(argc, argv);
}

QCoreApplication *MacPlatform::createClientApplication(int &argc, char **argv)
Expand Down

0 comments on commit a78292c

Please sign in to comment.