Files
loongoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
Stephan Bergmann 48d07b42b3 rhbz#2075918: Join ExtensionCmdQueue::Thread
...so that it can't still run when the main thread is already in DeInitVCL, and
this thread would crash with SIGSEGV at

> #6  0x00007fe79001ac74 in dp_gui::TheExtensionManager::modified (this=<optimized out>) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/desktop/source/deployment/gui/dp_gui_theextmgr.cxx:498
> #7  0x00007fe790834a0b in operator() (__closure=<optimized out>, xListener=...) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/desktop/source/deployment/manager/dp_extensionmanager.cxx:1416
> #8  cppu::OInterfaceContainerHelper::forEach<com::sun::util::XModifyListener, dp_manager::ExtensionManager::fireModified()::<lambda(const com::sun::uno::Reference<com::sun::util::XModifyListener>&)> > (func=..., this=<optimized out>) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/include/cppuhelper/interfacecontainer.h:292
> #9  dp_manager::ExtensionManager::fireModified (this=0x5613a450e050) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/desktop/source/deployment/manager/dp_extensionmanager.cxx:1414
> #10 0x00007fe79082d907 in dp_manager::ExtensionManager::activateExtension (this=0x5613a450e050, identifier=..., fileName=..., bUserDisabled=<optimized out>, bStartup=<optimized out>, xAbortChannel=..., xCmdEnv=...) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/desktop/source/deployment/manager/dp_extensionmanager.cxx:425
> #11 0x00007fe790830b5f in dp_manager::ExtensionManager::addExtension (this=0x5613a450e050, url=..., properties=..., repository=..., xAbortChannel=..., xCmdEnv=...) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/desktop/source/deployment/manager/dp_extensionmanager.cxx:721
> #12 0x00007fe79002d628 in dp_gui::ExtensionCmdQueue::Thread::_addExtension (bWarnUser=<optimized out>, rRepository=..., rPackageURL=..., rCmdEnv=..., this=0x5613a4753490) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:870
> #13 dp_gui::ExtensionCmdQueue::Thread::execute (this=0x5613a4753490) at /usr/src/debug/libreoffice-7.3.2.2-1.fc36.x86_64/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:744

(Which can apparently happen when you quit/restart LO quickly enough after
installing an extension through "Tools - Extension Manager...")

The join was missing ever since the code's introduction in
f167d090345c9c7950665e50006aff4fc0ace078 "INTEGRATION: CWS extmgrui01" (there
originally was an unused stopAndWait that would have joined, but which got
removed in 0014f10d9237e82357e11aedecca817f67827536 "#i105556#: remove unused
code", but there doesn't appear to be at least any obvious reason why joining in
~ExtensionCmdQueue should cause problems (at least with the recent fixes
2dce6754355a06e567427c39154d8747538864b1 "Reliably stop
ExtensionCmdQueue::Thread::execute" and 057f504e6518d1cefd141713c98a15cf9160e676
"Use the sander std::condition_variable semantics in
ExtensionCmdQueue::Thread".)

Change-Id: Iaad47fb77feed529dadf230088e1cb8ffccc80c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133248
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-21 11:44:51 +02:00

95 lines
3.5 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <sal/config.h>
#include <com/sun/star/uno/Reference.hxx>
#include <rtl/ref.hxx>
#include <vector>
#include "dp_gui_updatedata.hxx"
/// @HTML
namespace com::sun::star {
namespace task { class XInteractionRequest; }
namespace uno { class XComponentContext; }
}
namespace dp_gui {
class DialogHelper;
class TheExtensionManager;
/**
Manages installing of extensions in the GUI mode. Requests for installing
Extensions can be asynchronous. For example, the Extension Manager is running
in an office process and someone uses the system integration to install an Extension.
That is, the user double clicks an extension symbol in a file browser, which then
causes an invocation of "unopkg gui ext". When at that time the Extension Manager
already performs a task, triggered by the user (for example, add, update, disable,
enable) then adding of the extension will be postponed until the user has finished
the task.
This class also ensures that the extensions are not installed in the main thread.
Doing so would cause a deadlock because of the progress bar which needs to be constantly
updated.
*/
class ExtensionCmdQueue {
public:
/**
Create an instance.
*/
ExtensionCmdQueue( DialogHelper * pDialogHelper,
TheExtensionManager *pManager,
const css::uno::Reference< css::uno::XComponentContext > & rContext);
~ExtensionCmdQueue();
void addExtension( const OUString &rExtensionURL,
const OUString &rRepository,
const bool bWarnUser );
void removeExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage );
void enableExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage,
const bool bEnable );
void checkForUpdates( std::vector< css::uno::Reference< css::deployment::XPackage > > && vList );
void acceptLicense( const css::uno::Reference< css::deployment::XPackage > &rPackage );
static void syncRepositories( const css::uno::Reference< css::uno::XComponentContext > & xContext );
bool isBusy();
private:
ExtensionCmdQueue(ExtensionCmdQueue const &) = delete;
ExtensionCmdQueue& operator =(ExtensionCmdQueue const &) = delete;
class Thread;
rtl::Reference< Thread > m_thread;
};
void handleInteractionRequest( const css::uno::Reference< css::uno::XComponentContext > & xContext,
const css::uno::Reference< css::task::XInteractionRequest > & xRequest );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */