michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsQAppInstance.h" michael@0: #include michael@0: #include "prenv.h" michael@0: #include "nsXPCOMPrivate.h" michael@0: #include michael@0: michael@0: QGuiApplication *nsQAppInstance::sQAppInstance = nullptr; michael@0: int nsQAppInstance::sQAppRefCount = 0; michael@0: michael@0: void nsQAppInstance::AddRef(int& aArgc, char** aArgv, bool aDefaultProcess) { michael@0: if (qApp) michael@0: return; michael@0: if (!sQAppInstance) { michael@0: mozilla::SetICUMemoryFunctions(); michael@0: sQAppInstance = new QGuiApplication(aArgc, aArgv); michael@0: } michael@0: sQAppRefCount++; michael@0: } michael@0: michael@0: void nsQAppInstance::Release(void) { michael@0: if (sQAppInstance && !--sQAppRefCount) { michael@0: delete sQAppInstance; michael@0: sQAppInstance = nullptr; michael@0: } michael@0: }