[umbrello] [Bug 456427] code import crash

Xuxu <[email protected]>
Newsgroups gmane.linux.umbrello.devel
Message-ID <[email protected]/>
https://bugs.kde.org/show_bug.cgi?id=456427

Xuxu <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Xuxu <[email protected]> ---
I have a patch to fix this. you should patch `lib/cppparser/parser.cpp` with
below. 

>> I think use `&(*std::unique_ptr)` is superfluous. `std::unique_ptr.get()` have the same effect. Hope the maintainer fix this as soon as possible

***
umbrello branch release/22.08 
***

```
diff --color -uprN a/lib/cppparser/parser.cpp b/lib/cppparser/parser.cpp
--- a/lib/cppparser/parser.cpp  2022-10-11 03:38:32.000000000 +0800
+++ b/lib/cppparser/parser.cpp  2022-10-25 00:45:11.678067641 +0800
@@ -1844,7 +1844,7 @@ template<class Type>
 void Parser::eventuallyTakeComment(int startLn, int endLn, Type& ast)
 {
     if (comment().line() >= startLn && comment().line() <= endLn) {
-        if (&(*ast)) {
+        if (ast.get()) {
             if (comment()) {
                 ast->setComment(comment());
             }
@@ -1860,7 +1860,7 @@ void Parser::eventuallyTakeComment(Type&
     int line = currentLine();
     Comment c = m_commentStore.getCommentsInRange(line, true);

-    if (&(*ast) && c) {
+    if (ast.get() && c) {
         ast->setComment(c);
     }
 }
@@ -3158,7 +3158,7 @@ bool Parser::parseDeclarationInternal(De
             int endSignature = m_lexer->index();

             Comment mcomment;
-            if (&(*declarator)) {
+            if (declarator.get()) {
                 int endLine, endColumn;
                 declarator->getEndPosition(&endLine, &endColumn);
                 mcomment = m_commentStore.getCommentsInRange(endLine);
@@ -3294,7 +3294,7 @@ start_decl:
         }

         Comment mcomment;
-        if (&(*decl)) {
+        if (decl.get()) {
             int line, col;
             decl->getEndPosition(&line, &col);
             mcomment = m_commentStore.getCommentsInRange(line);
@@ -3311,7 +3311,7 @@ start_decl:
             SimpleDeclarationAST::Node ast =
CreateNode<SimpleDeclarationAST>();
             int line, col;
             ast->setComment(mcomment);
-            if (&(*decl)) {
+            if (decl.get()) {
                 decl->getEndPosition(&line, &col);

                 preparseLineComments(line);
@@ -3343,7 +3343,7 @@ start_decl:
                 FunctionDefinitionAST::Node ast =
CreateNode<FunctionDefinitionAST>();

                 ast->setComment(mcomment);
-                if (&(*decl)) {
+                if (decl.get()) {
                     int line, col;
                     decl->getEndPosition(&line, &col);

```

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.