Skip to content

Commit ad6d976

Browse files
committed
Fix macOS redraw crash after closing merge details
Sometimes, if the underlying PO file changed a lot, implicit redraw of the list control upon closing merge details would crash (referencing no longer existing CatalogItems). This doesn't have w/o showing the details because then the redraw would only happen after m_catalog was updated.
1 parent c2adfae commit ad6d976

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/edframe.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,7 @@ void PoeditFrame::UpdateCatalog(const wxString& pot_file)
15831583
// This ensures that the list control won't be redrawn during Update()
15841584
// call when a dialog box is hidden; another alternative would be to call
15851585
// m_list->CatalogChanged(NULL) here
1586+
// *or* to make sure PerformUpdateFromXXX() always returns a new Catalog instance
15861587
std::shared_ptr<wxWindowUpdateLocker> locker;
15871588
if (m_list)
15881589
locker.reset(new wxWindowUpdateLocker(m_list));
@@ -1617,7 +1618,7 @@ void PoeditFrame::UpdateCatalog(const wxString& pot_file)
16171618
bg_work = PerformUpdateFromReferenceWithUI(this, m_catalog, pot_file);
16181619
}
16191620

1620-
bg_work.then_on_main([=](CatalogPtr updated_catalog)
1621+
bg_work.then_on_main([this,locker](CatalogPtr updated_catalog)
16211622
{
16221623
if (!updated_catalog)
16231624
return;
@@ -1636,6 +1637,8 @@ void PoeditFrame::UpdateCatalog(const wxString& pot_file)
16361637
RefreshControls();
16371638
});
16381639
}
1640+
1641+
// locker gets released now and the list is redrawn
16391642
});
16401643
}
16411644

0 commit comments

Comments
 (0)