LibGUI: Clear out a GJsonArrayModel if it fails to open the JSON source

This fixes an issue in SystemMonitor where old data would linger in the
table views after selecting a process owned by another user.

Since we can no longer read /proc/PID/* unless PID belongs to us,
we will now present empty views for these processes. :^)
This commit is contained in:
Andreas Kling 2020-01-02 20:56:54 +01:00
parent efbdaaaa65
commit c6170070ed
Notes: sideshowbarker 2024-07-19 10:25:16 +09:00

View file

@ -7,6 +7,8 @@ void GJsonArrayModel::update()
auto file = CFile::construct(m_json_path);
if (!file->open(CIODevice::ReadOnly)) {
dbg() << "Unable to open " << file->filename();
m_array.clear();
did_update();
return;
}