Bug 264768

Summary: crash when changing dpi, in ScanParams::slotNewResolution
Product: [Applications] kooka Reporter: peter.geerds
Component: generalAssignee: Jonathan Marten <jjm>
Status: RESOLVED FIXED    
Severity: crash CC: momix1977, peter.geerds
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch to possibly fix

Description peter.geerds 2011-01-29 17:45:20 UTC
Application: kooka (0.60)
KDE Platform Version: 4.5.5 (KDE 4.5.5) "release 1"
Qt Version: 4.6.3
Operating System: Linux 2.6.34.7-0.7-default x86_64
Distribution: "openSUSE 11.3 (x86_64)"

-- Information about the crash:
- What I was doing when the application crashed: changing dpi (both: less or more); standard is 300 dpi, changing to 600 dpi or 150 dpi (or something else) kooka crashes every time.
The same happens by color, binary and gray and every size.

The crash can be reproduced every time.

-- Backtrace:
Application: Kooka (kooka), signal: Segmentation fault
[KCrash Handler]
#6  KScanOption::get (this=0x0, val=0x7fff9554efec) at /usr/src/debug/kooka-svn1197841/libkscan/kscanoption.cpp:661
#7  0x00007f99eeabd75b in ScanParams::slotNewResolution (this=0xa4f880, opt=<value optimized out>) at /usr/src/debug/kooka-svn1197841/libkscan/scanparams.cpp:1057
#8  0x00007f99eeac0214 in ScanParams::qt_metacall (this=0xa4f880, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff9554f150)
    at /usr/src/debug/kooka-svn1197841/build/libkscan/scanparams.moc:109
#9  0x00000000004348c0 in KookaScanParams::qt_metacall (this=0xa4f880, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff9554f150)
    at /usr/src/debug/kooka-svn1197841/build/kooka/kookascanparams.moc:73
#10 0x00007f99ece66a1f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#11 0x00007f99eeab297f in KScanOption::guiChange (this=<value optimized out>, _t1=0xa37f20) at /usr/src/debug/kooka-svn1197841/build/libkscan/kscanoption.moc:94
#12 0x00007f99eeab61b6 in KScanOption::slotWidgetChange (this=0xa37f20, t=<value optimized out>) at /usr/src/debug/kooka-svn1197841/libkscan/kscanoption.cpp:191
#13 0x00007f99eeab6271 in KScanOption::qt_metacall (this=0xa37f20, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff9554f2a0)
    at /usr/src/debug/kooka-svn1197841/build/libkscan/kscanoption.moc:80
#14 0x00007f99ece66a1f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#15 0x00007f99eeab0c62 in KScanControl::settingChanged (this=<value optimized out>, _t1=<value optimized out>) at /usr/src/debug/kooka-svn1197841/build/libkscan/kscancontrols.moc:89
#16 0x00007f99eeab0d17 in KScanControl::qt_metacall (this=0x970d60, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff9554f3c0)
    at /usr/src/debug/kooka-svn1197841/build/libkscan/kscancontrols.moc:75
#17 0x00007f99ece66a1f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#18 0x00007f99ec3e22a5 in QComboBox::activated(QString const&) () from /usr/lib64/libQtGui.so.4
#19 0x00007f99ec3e2307 in ?? () from /usr/lib64/libQtGui.so.4
#20 0x00007f99ec3e32f7 in ?? () from /usr/lib64/libQtGui.so.4
#21 0x00007f99ec3e63a7 in QComboBox::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/libQtGui.so.4
#22 0x00007f99ece66a1f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#23 0x00007f99ec67e0a2 in ?? () from /usr/lib64/libQtGui.so.4
#24 0x00007f99ec3dd8aa in ?? () from /usr/lib64/libQtGui.so.4
#25 0x00007f99ece52fd7 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#26 0x00007f99ec0274a1 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#27 0x00007f99ec03034a in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#28 0x00007f99ee108876 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#29 0x00007f99ece52e4c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#30 0x00007f99ec0291e5 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4
#31 0x00007f99ec0a3914 in ?? () from /usr/lib64/libQtGui.so.4
#32 0x00007f99ec0a1e19 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4
#33 0x00007f99ec0c8492 in ?? () from /usr/lib64/libQtGui.so.4
#34 0x00007f99e722bcb3 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#35 0x00007f99e722c490 in ?? () from /lib64/libglib-2.0.so.0
#36 0x00007f99e722c730 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#37 0x00007f99ece7b67f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#38 0x00007f99ec0c814e in ?? () from /usr/lib64/libQtGui.so.4
#39 0x00007f99ece52292 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#40 0x00007f99ece52495 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#41 0x00007f99ece5688b in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#42 0x0000000000422ca9 in main (argc=1, argv=0x7fff95550fd8) at /usr/src/debug/kooka-svn1197841/kooka/main.cpp:131

Reported using DrKonqi
Comment 1 Jonathan Marten 2011-02-15 14:02:39 UTC
*** Bug 266330 has been marked as a duplicate of this bug. ***
Comment 2 Jonathan Marten 2011-02-15 14:03:37 UTC
If possible, could you please let me know make/model of scanner and how
connected.  Could you also try running kooka in a terminal window and attach
the log output.
Comment 3 peter.geerds 2011-02-18 22:35:58 UTC
(In reply to comment #2)
> If possible, could you please let me know make/model of scanner and how
> connected.  Could you also try running kooka in a terminal window and attach
> the log output.

SCSI processor "EPSON Perfection1200 1.03" at /dev/sg5

scsi-modules:
aic7xxx               137233  0 
scsi_transport_spi     29902  1 aic7xxx
scsi_mod              190568  6 sg,sr_mod,sd_mod,aic7xxx,scsi_transport_spi,libata


terminal:
peter@thegnome:~> kooka 
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 55 (X_CreateGC)
  Resource id:  0x0
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 55 (X_CreateGC)
  Resource id:  0x0
X Error: BadGC (invalid GC parameter) 13
  Major opcode: 60 (X_FreeGC)
  Resource id:  0x0
X Error: BadGC (invalid GC parameter) 13
  Major opcode: 60 (X_FreeGC)
  Resource id:  0x0
KCrash: Application 'kooka' crashing...
KCrash: Attempting to start /usr/lib64/kde4/libexec/drkonqi from kdeinit
sock_file=/home/peter/.kde4/socket-thegnome/kdeinit4__0
Comment 4 Jonathan Marten 2011-02-27 16:01:51 UTC
Created attachment 57552 [details]
Patch to possibly fix

If either of you can compile from current SVN source, please try the attached patch and see if the crash is still present.  From the log files it seems to be one of those things that "shouldn't happen", but obviously it is...
Comment 5 peter.geerds 2011-02-27 17:05:34 UTC
> From: Jonathan Marten <jjm@keelhaul.me.uk>
> --- Comment #4 from Jonathan Marten <jjm keelhaul me uk>  2011-02-27 16:01:51 ---
> Created an attachment (id=57552)
>  --> (http://bugs.kde.org/attachment.cgi?id=57552)
> Patch to possibly fix
> 
> If either of you can compile from current SVN source, please try the attached
> patch and see if the crash is still present.  From the log files it seems to be
> one of those things that "shouldn't happen", but obviously it is...
> 
> -- 

 Great - it works fine! Every solution up to 2400 dpi.
Thank you very much!

cu
Peter
Comment 6 Jonathan Marten 2011-02-27 17:42:46 UTC
Thanks for trying the patch Peter.  Does this correctly update the previewer, i.e. does the size in pixels and the "expected file size" increase when the resolution is changed?

If nothing happens to that when the resolution changes, can you check for any debug messages containing "ScanParams::slotNewResolution" in the terminal/log output.  You may need to turn on kdebugdialog category 29000 (libkscan).
Comment 7 peter.geerds 2011-02-27 19:34:40 UTC
> From: Jonathan Marten <jjm@keelhaul.me.uk>
> --- Comment #6 from Jonathan Marten <jjm keelhaul me uk>  2011-02-27 17:42:46 ---
> Thanks for trying the patch Peter.  Does this correctly update the previewer,
> i.e. does the size in pixels and the "expected file size" increase when the
> resolution is changed?
> 
> If nothing happens to that when the resolution changes, can you check for any
> debug messages containing "ScanParams::slotNewResolution" in the terminal/log
> output.  You may need to turn on kdebugdialog category 29000 (libkscan).
> 
> --

The previewer works correctly, size in pixels und expectet
file size increase when I change the resolution:

215x297 mmm
423x585 pix
30,2KiB
-> 50 dpi

215x297 mm
5079x7016 pix
4,2 MiB
-> 600 dpi

It works perfectly for me!
A lot of thanks :-)

cu
Peter
Comment 8 Jonathan Marten 2011-02-28 18:32:04 UTC
SVN commit 1223148 by marten:

Fix null pointer crash when looking up the current scan resolution
if the SANE_NAME_SCAN_RESOLUTION and SANE_NAME_SCAN_X_RESOLUTION option
names are not the same and the scanner only has the former.  They were
equivalent in SANE 1.0.19, but in 1.0.20 they are different.

BUG:264768


 M  +15 -13    kscandevice.cpp  
 M  +15 -15    scanparams.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1223148
Comment 9 Jonathan Marten 2011-03-07 12:53:00 UTC
Git commit d65940eedfec2205a1d1005f560cd0a0b9e7a937 by Jonathan Marten.
Committed on 07/03/2011 at 12:48.
Pushed by marten into branch 'master'.

Fix NULL pointer crash in ScanParams::slotNewResolution()

Happens when looking up the current scan resolution if the
SANE_NAME_SCAN_RESOLUTION and SANE_NAME_SCAN_X_RESOLUTION option
names are not the same and the scanner only has the former.  They were
equivalent in SANE 1.0.19, but in 1.0.20 they are different.

BUG:264768

M  +15   -13   libkscan/kscandevice.cpp     
M  +15   -15   libkscan/scanparams.cpp     

http://commits.kde.org/kooka/d65940eedfec2205a1d1005f560cd0a0b9e7a937