Bug 133821 - crash (SIGSEGV) upon changing default for last external application
Summary: crash (SIGSEGV) upon changing default for last external application
Status: RESOLVED FIXED
Alias: None
Product: k3b
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR crash
Target Milestone: ---
Assignee: Sebastian Trueg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-09 21:01 UTC by Pier Luigi Pau
Modified: 2006-09-09 23:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pier Luigi Pau 2006-09-09 21:01:05 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc-4.1 Debian testing/unstable packages version 4.1.1ds1-13
OS:                Linux

This was reported to the Debian BTS, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=386688

I experience the bug in version 0.12.17 of k3b. I haven't tested
1.0pre or a svn snapshot, however, I suggest that the same bug can
be found in the 1.0 development tree as the code involved isn't
changed; see below for details.

k3b crashes with SIGSEGV upon changing the default for the external
application which appears last in the configuration widget (vcdxrip
in my case).

Way to reproduce:

1. You must have at least two choices for the last external
application listed, which means it has to be installed and k3b
has to find at least two binaries for the appropriate application.

In my case, vcdxrip is listed twice, because of a /usr/bin/X11 ->
/usr/bin symlink shipped by Debian package x11-common, meant for the
X11R6 to X11R7 transition, which makes every application be listed
as /usr/bin/(something) as well as /usr/bin/X11/(something).

2. Open the k3b menu: Settings -> Configure K3b...

3. Select Programs in the left section of the new window. The
'Programs' tab should be opened as default on the right.

4. Scroll all the way down the list of external application.

5. For the sake of example, let's assume that /usr/bin/X11/vcdxrip is
selected as default for vcdxrip. Select the *other* choice,
/usr/bin/vcdxrip in our example. The "Set Default" button becomes
available.

6. Click on the "Set Default" button. This triggers the SIGSEGV.

This is due to a missing check in src/option/k3bexternalbinwidget.cpp.
Before setting the new default, in
K3bExternalBinWidget::slotSetDefaultButtonClicked, the default flag is
removed from every item in the list which belongs to the intended
application. After the last ++it; statement when the end of the list is
reached, it->current() returns 0. The condition in the while statement,
used to check whether we've gone past the intended application,
doesn't check for a 0 before calling the parent() method, therefore
trying to evaluate 0->parent().

I have proposed a simple patch, which applies to version 0.12.17 of
k3b, together with my Debian bug report; please find it there (URL at
the beginning of this bug report).

The flawed while condition is unchanged so far in the 1.0 tree. It
should probably be fixed in a similar manner.
Comment 1 Sebastian Trueg 2006-09-09 23:34:55 UTC
SVN commit 582612 by trueg:

Do not crash when changing last program's default bin.

BUG: 133821


 M  +1 -1      k3bexternalbinwidget.cpp  


--- trunk/extragear/multimedia/k3b/src/option/k3bexternalbinwidget.cpp #582611:582612
@@ -288,7 +288,7 @@
     // remove all default flags
     K3bExternalBinViewItem* bi = (K3bExternalBinViewItem*)item->parentProgramItem()->firstChild();
     QListViewItemIterator it( bi );
-    while( it.current()->parent() == item->parentProgramItem() ) {
+    while( it.current() && it.current()->parent() == item->parentProgramItem() ) {
       ((K3bExternalBinViewItem*)it.current())->setDefault(false);
       ++it;
     }