Kaynağa Gözat

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. :^)
Andreas Kling 5 yıl önce
ebeveyn
işleme
c6170070ed
1 değiştirilmiş dosya ile 2 ekleme ve 0 silme
  1. 2 0
      Libraries/LibGUI/GJsonArrayModel.cpp

+ 2 - 0
Libraries/LibGUI/GJsonArrayModel.cpp

@@ -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;
     }