Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sot/source/base/object.cxx
Line
Count
Source
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 <sot/object.hxx>
21
#include <rtl/ref.hxx>
22
23
SotObject::SotObject()
24
694k
    : nOwnerLockCount(0)
25
694k
    , bInClose(false)
26
694k
{
27
694k
}
28
29
694k
SotObject::~SotObject() = default;
30
31
/** When the OwnerLock is decremented to zero, the DoClose method is called.
32
 *  This happens independently of the lock or RefCount. If the OwnerLock
33
 *  counter != zero, no DoClose is called by <SotObject::FuzzyLock>.
34
 *
35
 *  bLock - true, lock. false, unlock.
36
 */
37
void SotObject::OwnerLock(bool bLock)
38
325k
{
39
325k
    if (bLock)
40
162k
    {
41
162k
        nOwnerLockCount++;
42
162k
        acquire();
43
162k
    }
44
162k
    else if (nOwnerLockCount)
45
162k
    {
46
162k
        if (0 == --nOwnerLockCount)
47
162k
            DoClose();
48
162k
        release();
49
162k
    }
50
325k
}
51
52
bool SotObject::DoClose()
53
162k
{
54
162k
    bool bRet = false;
55
162k
    if (!bInClose)
56
162k
    {
57
162k
        rtl::Reference<SotObject> xHoldAlive(this);
58
162k
        bInClose = true;
59
162k
        bRet = Close();
60
162k
        bInClose = false;
61
162k
    }
62
162k
    return bRet;
63
162k
}
64
65
0
bool SotObject::Close() { return true; }
66
67
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */