2010-03-30 15:34:37 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-03-30 15:34:37 +04:00
|
|
|
|
|
|
|
#include "nsQAppInstance.h"
|
2014-02-21 06:09:02 +04:00
|
|
|
#include <QGuiApplication>
|
2010-05-24 16:21:52 +04:00
|
|
|
#include "prenv.h"
|
2014-02-11 10:35:32 +04:00
|
|
|
#include "nsXPCOMPrivate.h"
|
2011-10-18 04:53:37 +04:00
|
|
|
#include <stdlib.h>
|
2010-03-30 15:34:37 +04:00
|
|
|
|
2014-02-21 06:09:02 +04:00
|
|
|
QGuiApplication *nsQAppInstance::sQAppInstance = nullptr;
|
2010-03-30 15:34:37 +04:00
|
|
|
int nsQAppInstance::sQAppRefCount = 0;
|
|
|
|
|
2011-10-18 04:53:37 +04:00
|
|
|
void nsQAppInstance::AddRef(int& aArgc, char** aArgv, bool aDefaultProcess) {
|
|
|
|
if (qApp)
|
|
|
|
return;
|
2010-05-24 16:21:52 +04:00
|
|
|
if (!sQAppInstance) {
|
2014-02-11 10:35:32 +04:00
|
|
|
mozilla::SetICUMemoryFunctions();
|
2014-02-21 06:09:02 +04:00
|
|
|
sQAppInstance = new QGuiApplication(aArgc, aArgv);
|
2010-05-24 16:21:52 +04:00
|
|
|
}
|
2010-03-30 15:34:37 +04:00
|
|
|
sQAppRefCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsQAppInstance::Release(void) {
|
|
|
|
if (sQAppInstance && !--sQAppRefCount) {
|
|
|
|
delete sQAppInstance;
|
2013-10-11 00:36:42 +04:00
|
|
|
sQAppInstance = nullptr;
|
2010-03-30 15:34:37 +04:00
|
|
|
}
|
|
|
|
}
|