activities: Close the database connection to prevent file descriptor leak

Authored by akandaurov on Apr 11 2020, 4:20 PM.

Description

activities: Close the database connection to prevent file descriptor leak

Summary: The connection to the database doesn't get closed, which leads to a leakage of file descriptors to kactivities database files, eventually reaching the open file limit. Also, sometimes warnings about duplicate connections may appear in the console. This patch fixes this by closing and removing the connection.

Test Plan:

  1. Right-click a file in Dolphin and hover the Activities menu. Do it several times.
  2. Check the output of
ls -l /proc/`pidof dolphin`/fd

for open descriptors to ~/.local/share/kactivitymanagerd/resources/database{,-wal}.

Reviewers: ivan, meven

Reviewed By: meven

Subscribers: meven, kde-frameworks-devel, kfm-devel

Tags: Dolphin, Frameworks

Differential Revision: https://phabricator.kde.org/D28739