Skip to content

Commit 48d71a3

Browse files
committed
In wxMaxima destructor, ensure that Maxima share dir has been assigned a value
before trying to use it to open the builtins-list.txt file. This fixes a "file not found" error which I encountered when running $ ctest -R multiple_batch_files2_singlethread
1 parent e34ca09 commit 48d71a3

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/wxMaxima.cpp

+13-7
Original file line numberDiff line numberDiff line change
@@ -1909,17 +1909,23 @@ wxMaxima::~wxMaxima() {
19091909
for(const auto &i : GetWorksheet()->m_maximaManual.GetHelpfileAnchors())
19101910
knownWords[i.first] |= 2;
19111911

1912-
wxFileInputStream builtintxt(m_configuration.MaximaShareDir() + "/builtins-list.txt");
1913-
if(builtintxt.IsOk())
1912+
wxString maxima_share_dir = m_configuration.MaximaShareDir();
1913+
1914+
if (maxima_share_dir.length () > 0)
19141915
{
1915-
wxTextInputStream txt(builtintxt);
1916-
while(!builtintxt.Eof())
1916+
wxFileInputStream builtintxt(maxima_share_dir + "/builtins-list.txt");
1917+
if(builtintxt.IsOk())
19171918
{
1918-
wxString line;
1919-
line = txt.ReadLine();
1920-
knownWords[line] |= 4;
1919+
wxTextInputStream txt(builtintxt);
1920+
while(!builtintxt.Eof())
1921+
{
1922+
wxString line;
1923+
line = txt.ReadLine();
1924+
knownWords[line] |= 4;
1925+
}
19211926
}
19221927
}
1928+
19231929
std::vector<wxString> knownwords_sorted;
19241930
for(const auto &i : knownWords)
19251931
knownwords_sorted.push_back(i.first);

0 commit comments

Comments
 (0)