Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes on my GNU computer #47

Open
Retera opened this issue Aug 8, 2024 · 1 comment
Open

Crashes on my GNU computer #47

Retera opened this issue Aug 8, 2024 · 1 comment

Comments

@Retera
Copy link

Retera commented Aug 8, 2024

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
Copy link
Author

Retera commented Aug 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant