GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_window_root_delete.c Lines: 13 13 100.0 %
Date: 2026-03-06 19:21:09 Branches: 6 6 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   Window Management (Window)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_system.h"
29
#include "gx_window.h"
30
#include "gx_widget.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_window_root_delete                              PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function delets a previous-created root window                 */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    root_window                           Window control block          */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    memset                                Set control block to zero     */
58
/*    _gx_system_all_views_free             Free up all view ports        */
59
/*    _gx_widget_delete                     Delete widget                 */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/**************************************************************************/
66
4
UINT  _gx_window_root_delete(GX_WINDOW_ROOT *root_window)
67
{
68
GX_WINDOW_ROOT *previous;
69
70
4
    _gx_system_all_views_free(root_window);
71
72
4
    if (_gx_system_root_window_created_list == root_window)
73
    {
74
1
        _gx_system_root_window_created_list = (GX_WINDOW_ROOT *)_gx_system_root_window_created_list -> gx_widget_next;
75
    }
76
    else
77
    {
78
3
        previous = _gx_system_root_window_created_list;
79
80
4
        while (previous)
81
        {
82
3
            if ((GX_WINDOW_ROOT *)previous -> gx_widget_next == root_window)
83
            {
84
2
                previous -> gx_widget_next = root_window -> gx_widget_next;
85
2
                break;
86
            }
87
88
1
            previous = (GX_WINDOW_ROOT *)previous -> gx_widget_next;
89
        }
90
    }
91
92
4
    _gx_widget_delete((GX_WIDGET *)root_window);
93
94
    /* Clear the root window control block.  */
95
4
    memset(root_window, 0, sizeof(GX_WINDOW_ROOT));
96
97
4
    return(GX_SUCCESS);
98
}
99