tdauth / vjasside

IDE for the scripting languages JASS and vJass of the computer game Warcraft III.
0 stars 0 forks source link

Crashes on my GNU computer #47

Open Retera opened 3 months ago

Retera commented 3 months ago

I tried compiling this program and then using it to open a file on my GNU computer. But after I opened my custom .j file, I received a Segmentation Fault. I tried to get a stacktrace and it looked like this:

0x00005555555a5320 in VJassParseError::getLine() const ()
(gdb) bt full
#0  0x00005555555a5320 in VJassParseError::getLine() const ()
No symbol table info available.
#1  0x000055555558bf8d in void std::__introsort_loop<QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}> >(QList<VJassParseError>::iterator, QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}>) ()
No symbol table info available.
#2  0x000055555558c06c in void std::__introsort_loop<QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}> >(QList<VJassParseError>::iterator, QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}>) ()
No symbol table info available.
#3  0x000055555558c06c in void std::__introsort_loop<QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}> >(QList<VJassParseError>::iterator, QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}>) ()
No symbol table info available.
#4  0x000055555558c06c in void std::__introsort_loop<QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}> >(QList<VJassParseError>::iterator, QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}>) ()
No symbol table info available.
#5  0x000055555558c06c in void std::__introsort_loop<QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}> >(QList<VJassParseError>::iterator, QList<VJassParseError>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool)::{lambda(VJassParseError&, VJassParseError&)#1}>) ()
No symbol table info available.
#6  0x000055555558d165 in HighLightInfo::HighLightInfo(QString const&, QList<VJassToken> const&, VJassAst*, QList<VJassParseError> const&, bool, bool, bool) ()
No symbol table info available.
#7  0x000055555559bd92 in MainWindow::MainWindow(QWidget*)::{lambda()#1}::operator()() const ()
No symbol table info available.
#8  0x000055555559c359 in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<QtPrivate::Callable<MainWindow::MainWindow(QWidget*)::{lambda()#1}> > >, void> >::_M_invoke(std::_Any_data const&) ()
No symbol table info available.
#9  0x000055555559d8db in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
No symbol table info available.
Retera commented 3 months ago
diff --git a/src/app/highlightinfo.cpp b/src/app/highlightinfo.cpp
index 80ad39c..c630b88 100644
--- a/src/app/highlightinfo.cpp
+++ b/src/app/highlightinfo.cpp
@@ -148,10 +148,10 @@ HighLightInfo::HighLightInfo(const QString &text, const QList<VJassToken> &token
            const int lineDiff = e1.getLine() - e2.getLine();

            if (lineDiff == 0) {
-               return e1.getColumn() - e2.getColumn();
+               return e1.getColumn() < e2.getColumn();
            }

-           return lineDiff;
+           return lineDiff < 0;
         });

         if (analyzeMemoryLeaks) {

It seems that with the above change, I was able to hack-away my Segmentation Fault. It was the result of some guesswork based on the stack trace. Perhaps my system requires comparison functions to return a boolean value instead of the result of a subtraction.