mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Assertions when doing Export As... (#10321)
Fix assertion with gcc 6: The comparison function must be a strict weak orderings and not give x < x. Fix assertion when a custom exportable document format is given a non-ASCII name. Use qt_ to be consistent with the rest of the code. Use Qt's locale-aware comparison for appropriate sorting.
This commit is contained in:
parent
f323a64fc3
commit
5ded0d002d
@ -2569,15 +2569,6 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname, RenameKind kin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct PrettyNameComparator
|
|
||||||
{
|
|
||||||
bool operator()(Format const *first, Format const *second) const {
|
|
||||||
return compare_no_case(translateIfPossible(from_ascii(first->prettyname())),
|
|
||||||
translateIfPossible(from_ascii(second->prettyname()))) <= 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
bool GuiView::exportBufferAs(Buffer & b, docstring const & iformat)
|
bool GuiView::exportBufferAs(Buffer & b, docstring const & iformat)
|
||||||
{
|
{
|
||||||
FileName fname = b.fileName();
|
FileName fname = b.fileName();
|
||||||
@ -2593,8 +2584,12 @@ bool GuiView::exportBufferAs(Buffer & b, docstring const & iformat)
|
|||||||
for (; it != formats.end(); ++it)
|
for (; it != formats.end(); ++it)
|
||||||
if (it->documentFormat())
|
if (it->documentFormat())
|
||||||
export_formats.push_back(&(*it));
|
export_formats.push_back(&(*it));
|
||||||
PrettyNameComparator cmp;
|
sort(export_formats.begin(), export_formats.end(),
|
||||||
sort(export_formats.begin(), export_formats.end(), cmp);
|
[](Format const *first, Format const *second) {
|
||||||
|
QString name1 = qt_(first->prettyname());
|
||||||
|
QString name2 = qt_(second->prettyname());
|
||||||
|
return 0 < name2.localeAwareCompare(name1);
|
||||||
|
});
|
||||||
vector<Format const *>::const_iterator fit = export_formats.begin();
|
vector<Format const *>::const_iterator fit = export_formats.begin();
|
||||||
map<QString, string> fmap;
|
map<QString, string> fmap;
|
||||||
QString filter;
|
QString filter;
|
||||||
|
Loading…
Reference in New Issue
Block a user