office-gobmx/include/svtools/asynclink.hxx
Stephan Bergmann a4348ec796 We no longer know how to contact TLX anyway
GCC 12 trunk started to warn

> svtools/source/control/asynclink.cxx: In member function ‘void svtools::AsynchronLink::HandleCall_PostUserEvent(void*)’:
> svtools/source/control/asynclink.cxx:76:15: error: storing the address of local variable ‘bDeleted’ in ‘*this.svtools::AsynchronLink::_pDeleted’ [-Werror=dangling-pointer=]
>    76 |     _pDeleted = &bDeleted;
>       |     ~~~~~~~~~~^~~~~~~~~~~
> svtools/source/control/asynclink.cxx:75:10: note: ‘bDeleted’ declared here
>    75 |     bool bDeleted = false;
>       |          ^~~~~~~~
> svtools/source/control/asynclink.cxx:75:10: note: ‘<unknown>’ declared here

And while that is arguably a false warning, it points at some dubious code
anyway:  The only reason for the AsynchronLink _bInCall and _pDeleted members is
to potentially SAL_INFO some "valuable historical artefact", if
AsynchronLink::Call were ever called recursively.  But
0de7513cd7 "osl::Mutex->std::mutex in
AsynchronLink" apparently already argued that such recursive calls can never
happen, as locking _aMutex in a recursive call of Call would now deadlock.

Change-Id: I9ee47ac65652e40e23a37be3d0694fa1185b877a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129104
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-28 16:14:46 +01:00

61 lines
1.8 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 <config_options.h>
#include <svtools/svtdllapi.h>
#include <tools/link.hxx>
#include <vcl/idle.hxx>
#include <mutex>
class Timer;
struct ImplSVEvent;
namespace svtools {
class UNLESS_MERGELIBS(SVT_DLLPUBLIC) AsynchronLink
{
Link<void*,void> _aLink;
ImplSVEvent* _nEventId;
void* _pArg;
std::mutex _aMutex;
DECL_DLLPRIVATE_LINK( HandleCall_PostUserEvent, void*, void );
public:
AsynchronLink( const Link<void*,void>& rLink )
: _aLink( rLink )
, _nEventId( nullptr )
, _pArg( nullptr )
{}
AsynchronLink()
: _nEventId( nullptr )
, _pArg( nullptr )
{}
~AsynchronLink();
void operator=( const Link<void*,void>& rLink ) { _aLink = rLink; }
void Call( void* pObj, bool bAllowDoubles = false );
void ClearPendingCall( );
};
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */