# Buggy code
def __init__(self, parent=None):
    super(RemoteTableModel, self).__init__(parent)
    # Unique identifier mapping for items. For torrents, it is infohash and for channels, it is concatenated value
    # of public key and channel id
    self.item_uid_map = {}

    self.data_items = []
    self.item_load_batch = 50
    self.sort_by = (
        self.columns[self.default_sort_column]
        if self.default_sort_column >= 0
        else None
    )
    self.sort_desc = True
    self.saved_header_state = None
    self.saved_scroll_state = None

    # Every remote query must be attributed to its specific model to avoid updating wrong models
    # on receiving a result. We achieve this by maintaining a set of in-flight remote queries.
    # Note that this only applies to results that are returned through the events notification
    # mechanism, because REST requests attribution is maintained by the RequestManager.
    # We do not clean it up after receiving a result because we don't know if the result was the
    # last one. In a sense, the queries' UUIDs play the role of "subscription topics" for the model.
    self.remote_queries = set()


# Traceback (RuntimeError)
Traceback (most recent call last):,
File "src\run_tribler.py", line 179, in <module>,
File "src\tribler-gui\tribler_gui\utilities.py", line 382, in trackback_wrapper,
File "src\tribler-gui\tribler_gui\widgets\triblertablecontrollers.py", line 88, in _on_filter_input_change,
File "src\tribler-gui\tribler_gui\widgets\tablecontentmodel.py", line 379, in reset,
File "src\tribler-gui\tribler_gui\widgets\tablecontentmodel.py", line 61, in reset,
File "src\tribler-gui\tribler_gui\widgets\tablecontentmodel.py", line 424, in perform_query,
File "src\tribler-gui\tribler_gui\widgets\tablecontentmodel.py", line 184, in perform_query,
File "src\tribler-gui\tribler_gui\tribler_request_manager.py", line 176, in __init__,
tribler_gui.utilities.CreationTraceback,
The above exception was the direct cause of the following exception:,
Traceback (most recent call last):,
File "src\tribler-gui\tribler_gui\utilities.py", line 385, in trackback_wrapper,
File "src\tribler-gui\tribler_gui\utilities.py", line 382, in trackback_wrapper,
File "src\tribler-gui\tribler_gui\widgets\tablecontentmodel.py", line 212, in on_query_results,
RuntimeError: wrapped C/C++ object of type ChannelContentModel has been deleted

# Fixed code
def __init__(self, parent=None):
    super(RemoteTableModel, self).__init__(parent)
    # Unique identifier mapping for items. For torrents, it is infohash and for channels, it is concatenated value
    # of public key and channel id
    self.item_uid_map = {}

    self.data_items = []
    self.item_load_batch = 50
    self.sort_by = (
        self.columns[self.default_sort_column]
        if self.default_sort_column >= 0
        else None
    )
    self.sort_desc = True
    self.saved_header_state = None
    self.saved_scroll_state = None
    self.qt_object_destroyed = False

    connect(self.destroyed, self.on_destroy)
    # Every remote query must be attributed to its specific model to avoid updating wrong models
    # on receiving a result. We achieve this by maintaining a set of in-flight remote queries.
    # Note that this only applies to results that are returned through the events notification
    # mechanism, because REST requests attribution is maintained by the RequestManager.
    # We do not clean it up after receiving a result because we don't know if the result was the
    # last one. In a sense, the queries' UUIDs play the role of "subscription topics" for the model.
    self.remote_queries = set()