LibreOffice Module sfx2 (master) 1
itemdel.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <itemdel.hxx>
23#include <svl/poolitem.hxx>
24#include <vcl/idle.hxx>
25#include <vcl/svapp.hxx>
26
27#include <tools/debug.hxx>
28
30{
31public:
32 static void DeleteItemOnIdle(std::unique_ptr<SfxPoolItem> pItem)
33 {
34 pItem->SetKind(SfxItemKind::DeleteOnIdle);
36 // coverity[leaked_storage] - pDisruptor takes care of its own destruction at idle time
37 }
38
40};
41
43{
44 SfxPoolItem* pItem = static_cast<SfxPoolItem*>(p);
45 // reset RefCount (was set to SFX_ITEMS_SPECIAL before!)
46 pItem->SetRefCount(0);
47 delete pItem;
48}
49
50void DeleteItemOnIdle(std::unique_ptr<SfxPoolItem> pItem)
51{
52 DBG_ASSERT(0 == pItem->GetRefCount(), "deleting item in use");
54}
55
56/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void DeleteItemOnIdle(std::unique_ptr< SfxPoolItem > pItem)
Definition: itemdel.cxx:32
DECL_STATIC_LINK(SfxItemDisruptor_Impl, Delete, void *, void)
void SetRefCount(sal_uInt32 n)
#define DBG_ASSERT(sCon, aError)
IMPL_STATIC_LINK(SfxItemDisruptor_Impl, Delete, void *, p, void)
Definition: itemdel.cxx:42
void DeleteItemOnIdle(std::unique_ptr< SfxPoolItem > pItem)
Definition: itemdel.cxx:50
void * p