소스 검색

Spreadsheet: Avoid making StringView of temporary ByteBuffer

Ben Wiederhake 3 년 전
부모
커밋
4ef9a1ba48
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      Userland/Applications/Spreadsheet/SpreadsheetModel.cpp

+ 2 - 1
Userland/Applications/Spreadsheet/SpreadsheetModel.cpp

@@ -115,9 +115,10 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio
     VERIFY(cursor);
 
     Position cursor_position { (size_t)cursor->column(), (size_t)cursor->row() };
+    auto mime_data_buffer = mime_data->data("text/x-spreadsheet-data");
     auto new_data = String::formatted("{}\n{}",
         cursor_position.to_url(m_sheet).to_string(),
-        StringView(mime_data->data("text/x-spreadsheet-data")));
+        StringView(mime_data_buffer));
     mime_data->set_data("text/x-spreadsheet-data", new_data.to_byte_buffer());
 
     return mime_data;