FIX: PrinterFileSystem crash when switch file type
Change-Id: I25b0659d7a33bda5bb1157c967dac300b41696a9 Github: 2633
This commit is contained in:
parent
72dc26150f
commit
7bbb7e7ca4
|
@ -92,8 +92,12 @@ void Slic3r::GUI::ImageGrid::SetFileType(int type, std::string const &storage)
|
||||||
|
|
||||||
void Slic3r::GUI::ImageGrid::SetGroupMode(int mode)
|
void Slic3r::GUI::ImageGrid::SetGroupMode(int mode)
|
||||||
{
|
{
|
||||||
if (!m_file_sys || m_file_sys->GetCount() == 0)
|
if (!m_file_sys)
|
||||||
return;
|
return;
|
||||||
|
if (m_file_sys->GetCount() == 0) {
|
||||||
|
m_file_sys->SetGroupMode((PrinterFileSystem::GroupMode) mode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
wxSize size = GetClientSize();
|
wxSize size = GetClientSize();
|
||||||
int index = (m_row_offset + 1 < m_row_count || m_row_count == 0)
|
int index = (m_row_offset + 1 < m_row_count || m_row_count == 0)
|
||||||
? m_row_offset / 4 * m_col_count
|
? m_row_offset / 4 * m_col_count
|
||||||
|
|
|
@ -104,6 +104,7 @@ void PrinterFileSystem::SetFileType(FileType type, std::string const &storage)
|
||||||
m_file_list.swap(m_file_list_cache[{m_file_type, m_file_storage}]);
|
m_file_list.swap(m_file_list_cache[{m_file_type, m_file_storage}]);
|
||||||
m_lock_start = m_lock_end = 0;
|
m_lock_start = m_lock_end = 0;
|
||||||
BuildGroups();
|
BuildGroups();
|
||||||
|
UpdateGroupSelect();
|
||||||
SendChangedEvent(EVT_FILE_CHANGED);
|
SendChangedEvent(EVT_FILE_CHANGED);
|
||||||
if (type == F_INVALID_TYPE)
|
if (type == F_INVALID_TYPE)
|
||||||
return;
|
return;
|
||||||
|
@ -530,10 +531,10 @@ void PrinterFileSystem::Stop(bool quit)
|
||||||
|
|
||||||
void PrinterFileSystem::BuildGroups()
|
void PrinterFileSystem::BuildGroups()
|
||||||
{
|
{
|
||||||
if (m_file_list.empty())
|
|
||||||
return;
|
|
||||||
m_group_year.clear();
|
m_group_year.clear();
|
||||||
m_group_month.clear();
|
m_group_month.clear();
|
||||||
|
if (m_file_list.empty())
|
||||||
|
return;
|
||||||
wxDateTime t = wxDateTime((time_t) m_file_list.front().time);
|
wxDateTime t = wxDateTime((time_t) m_file_list.front().time);
|
||||||
m_group_year.push_back(0);
|
m_group_year.push_back(0);
|
||||||
m_group_month.push_back(0);
|
m_group_month.push_back(0);
|
||||||
|
|
Loading…
Reference in New Issue