소스 검색

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 년 전
부모
커밋
c6170070ed
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  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);
     auto file = CFile::construct(m_json_path);
     if (!file->open(CIODevice::ReadOnly)) {
     if (!file->open(CIODevice::ReadOnly)) {
         dbg() << "Unable to open " << file->filename();
         dbg() << "Unable to open " << file->filename();
+        m_array.clear();
+        did_update();
         return;
         return;
     }
     }