https://bugs.kde.org/show_bug.cgi?id=439676

            Bug ID: 439676
           Summary: Crash on startup when providing two directories as
                    args
           Product: kdiff3
           Version: unspecified
          Platform: Compiled Sources
                OS: All
            Status: REPORTED
          Severity: grave
          Priority: NOR
         Component: application
          Assignee: reeves...@gmail.com
          Reporter: hl037.p...@gmail.com
  Target Milestone: ---

Application: kdiff3 (1.9.70(64 bits))

Qt Version: 5.15.2
Frameworks Version: 5.83.0
Operating System: Linux 5.12.10-arch1-1 x86_64
Windowing System: X11
Drkonqi Version: 5.22.0
Distribution: "Arch Linux"

-- Information about the crash:
With The master branch, when launching with two arguments, it segfaults.

This fixes the bug :

```
diff --git a/src/pdiff.cpp b/src/pdiff.cpp
index 8467ffc..79c2753 100644
--- a/src/pdiff.cpp
+++ b/src/pdiff.cpp
@@ -1610,6 +1610,10 @@ bool KDiff3App::doDirectoryCompare(const bool
bCreateNewInstance)
         m_pMainWidget->hide();
         setUpdatesEnabled(true);

+        if(m_dirinfo == nullptr){
+          m_dirinfo = QSharedPointer<DirectoryInfo>::create();
+          MergeFileInfos::setDirectoryInfo(m_dirinfo);
+        }
         (*m_dirinfo) = DirectoryInfo(f1, f2, f3, destDir);

         bool bSuccess = m_pDirectoryMergeWindow->init(
```

But I Think m_dirinfo should have been already initialized... Because this is
redundant with `void KDiff3App::slotFileOpen()`.


However, I may ask why is MergeFileInfos::m_dirinfo static ? I have the feeling
it's not a good design, and that it would have been better to make it an
instance attribute...

The crash can be reproduced every time.

-- Backtrace:
Application: KDiff3 (kdiff3), signal: Segmentation fault

[KCrash Handler]
#4  0x00005594b2afb786 in QScopedPointer<FileAccessJobHandler,
QScopedPointerDeleter<FileAccessJobHandler> >::reset (this=0x8,
other=0x5594b3062ba0) at /usr/include/qt/QtCore/qscopedpointer.h:155
#5  0x00005594b2af5e18 in FileAccess::operator= (this=0x0, b=...) at
/home/leo/projects/sources/kdiff3/src/fileaccess.cpp:165
#6  0x00005594b2a88943 in DirectoryInfo::operator= (this=0x0) at
/home/leo/projects/sources/kdiff3/src/DirectoryInfo.h:13
#7  0x00005594b2a834e3 in KDiff3App::doDirectoryCompare (this=0x5594b30a17f0,
bCreateNewInstance=false) at
/home/leo/projects/sources/kdiff3/src/pdiff.cpp:1613
#8  0x00005594b2a3a4b4 in KDiff3App::completeInit (this=0x5594b30a17f0,
fn1=..., fn2=..., fn3=...) at
/home/leo/projects/sources/kdiff3/src/kdiff3.cpp:414
#9  0x00005594b2a2f658 in KDiff3Shell::KDiff3Shell (this=0x5594b2e51840,
bCompleteInit=true, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at
/home/leo/projects/sources/kdiff3/src/kdiff3_shell.cpp:60
#10 0x00005594b2a2c181 in main (argc=3, argv=0x7ffcdb3a39b8) at
/home/leo/projects/sources/kdiff3/src/main.cpp:186
[Inferior 1 (process 35053) detached]

Possible duplicates by query: bug 430698, bug 429420, bug 410860.

Rapporter à https://bugs.kde.org/

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to