Bug 312417 - kdiff3 w/ qt 4.8.4 crashes upon close
Summary: kdiff3 w/ qt 4.8.4 crashes upon close
Status: RESOLVED NOT A BUG
Alias: None
Product: kdiff3
Classification: Applications
Component: application (show other bugs)
Version: 0.9.97
Platform: Gentoo Packages Linux
: NOR critical
Target Milestone: ---
Assignee: Joachim Eibl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-31 05:24 UTC by Daniel Santos
Modified: 2013-01-06 02:01 UTC (History)
2 users (show)

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 Daniel Santos 2012-12-31 05:24:08 UTC
Downstream bug: https://bugs.gentoo.org/show_bug.cgi?id=449382

This was fine on 4.8.2, but I upgraded to 4.8.4 and now kdiff3 and my heart are both broken.  Even though the app still works and I can save the merge result, git still thinks I'm a homeless bum w/o a clue as to how to resolve the conflicts and refuses to accept them (since the return value from kdiff3 is non-zero, of course).

For the full details on my system, bio, turn-ons, turn-offs, etc., view the downstream bug report above.

At the below context, we call glXMakeCurrent (NVidia's 310.19 libGL) and get a bad return value and this at the console:
X Error: BadMatch (invalid parameter attributes) 8
  Extension:    152 (Uknown extension)
  Minor opcode: 5 (Unknown request)
  Resource id:  0x5600017

#0  QGLContext::makeCurrent (this=0xcd0290) at qgl_x11.cpp:934
#1  0x00007fffea085b02 in QGLShareContextScope::QGLShareContextScope (this=0x7fffffffd780, ctx=0xcd0290) at qgl_p.h:493
#2  0x00007fffea117651 in QGLContextGroupResource<QGLGlyphTexture>::~QGLContextGroupResource (this=0xf082f0, __in_chrg=<optimized out>) at ../../src/opengl/qgl_p.h:768
#3  0x00007fffea115916 in QGLTextureGlyphCache::~QGLTextureGlyphCache (this=0xf08220, __in_chrg=<optimized out>) at gl2paintengineex/qtextureglyphcache_gl.cpp:90
#4  0x00007fffea1159c2 in QGLTextureGlyphCache::~QGLTextureGlyphCache (this=0xf08220, __in_chrg=<optimized out>) at gl2paintengineex/qtextureglyphcache_gl.cpp:96
#5  0x00007ffff66c1f5c in ~QExplicitlySharedDataPointer (this=0xf08e08, __in_chrg=<optimized out>) at ../../src/corelib/tools/qshareddata.h:166
#6  ~GlyphCacheEntry (this=0xf08e00, __in_chrg=<optimized out>) at ../../src/gui/text/qfontengine_p.h:283
#7  ~QLinkedListNode (this=0xf08df0, __in_chrg=<optimized out>) at ../../src/corelib/tools/qlinkedlist.h:70
#8  QLinkedList<QFontEngine::GlyphCacheEntry>::free (x=0xd6d8a0, this=<optimized out>) at ../../src/corelib/tools/qlinkedlist.h:304
#9  0x00007ffff66c7800 in operator= (l=..., this=0xb0b080) at ../../src/corelib/tools/qlinkedlist.h:323
#10 QLinkedList<QFontEngine::GlyphCacheEntry>::clear (this=this@entry=0xb0b080) at ../../src/corelib/tools/qlinkedlist.h:313
#11 0x00007ffff66c6604 in QFontEngine::~QFontEngine (this=0xb0aff0, __in_chrg=<optimized out>) at text/qfontengine.cpp:193
#12 0x00007ffff6787ac9 in QFontEngineX11FT::~QFontEngineX11FT (this=0xb0aff0, __in_chrg=<optimized out>) at text/qfontengine_x11.cpp:1128
#13 0x00007ffff66c67b2 in QFontEngineMulti::~QFontEngineMulti (this=0xa9bd00, __in_chrg=<optimized out>) at text/qfontengine.cpp:1331
#14 0x00007ffff678918e in QFontEngineMultiFT::~QFontEngineMultiFT (this=0xa9bd00, __in_chrg=<optimized out>) at text/qfontengine_x11.cpp:887
#15 0x00007ffff67892c9 in QFontEngineMultiFT::~QFontEngineMultiFT (this=0xa9bd00, __in_chrg=<optimized out>) at text/qfontengine_x11.cpp:897
#16 0x00007ffff66bead1 in QFontCache::clear (this=this@entry=0xa37560) at text/qfont.cpp:2875
#17 0x00007ffff66bebfa in QFontCache::~QFontCache (this=0xa37560, __in_chrg=<optimized out>) at text/qfont.cpp:2815
#18 0x00007ffff66bed69 in QFontCache::~QFontCache (this=0xa37560, __in_chrg=<optimized out>) at text/qfont.cpp:2846
#19 0x00007ffff595f6b5 in QThreadStorageData::set (this=<optimized out>, p=0x0) at thread/qthreadstorage.cpp:165
#20 0x00007ffff6512eca in qt_cleanup () at kernel/qapplication_x11.cpp:2682
#21 0x00007ffff64a1a1e in QApplication::~QApplication (this=0x7fffffffdc20, __in_chrg=<optimized out>) at kernel/qapplication.cpp:1190
#22 0x00000000004248b6 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kde-misc/kdiff3-0.9.97-r1/kdiff3-0.9.97/src-QT4/main.cpp:266

The next time we call QGLContext::makeCurrent, we get a crash. It winds up calling glXMakeCurrent with a NULL pointer for dpy, which is propogated on to libX11's XQueryExtension.

#0  XQueryExtension (dpy=dpy@entry=0x0, name=name@entry=0x7fffe9a9e394 "GLX", major_opcode=major_opcode@entry=0x7fffffffcef4, first_event=first_event@entry=0x7fffffffcef8, 
    first_error=first_error@entry=0x7fffffffcefc) at /usr/src/debug/x11-libs/libX11-1.5.0/libX11-1.5.0/src/QuExt.c:43
#1  0x00007ffff3bdfa82 in XInitExtension (dpy=dpy@entry=0x0, name=name@entry=0x7fffe9a9e394 "GLX") at /usr/src/debug/x11-libs/libX11-1.5.0/libX11-1.5.0/src/InitExt.c:47
#2  0x00007ffff0357a56 in XextAddDisplay (extinfo=0x73b5c0, dpy=0x0, ext_name=0x7fffe9a9e394 "GLX", hooks=0x7fffe9ccd2e0, nevents=<optimized out>, data=0x0)
    at /usr/src/debug/x11-libs/libXext-1.3.1/libXext-1.3.1/src/extutil.c:110
#3  0x00007fffe9a60467 in ?? () from /usr/lib64/libGL.so.1
#4  0x00007fffe9a60cca in ?? () from /usr/lib64/libGL.so.1
#5  0x00007fffe9a6138a in ?? () from /usr/lib64/libGL.so.1
#6  0x00007fffe9a62749 in ?? () from /usr/lib64/libGL.so.1
#7  0x00007fffe9dd37c1 in QGLContext::makeCurrent (this=0xd51120) at qgl_x11.cpp:934
#8  0x00007fffe9d3eb02 in QGLShareContextScope::QGLShareContextScope (this=0x7fffffffd160, ctx=0xd51120) at qgl_p.h:493
#9  0x00007fffe9da5a8b in QGLContextGroupResource<QGLEngineSharedShaders>::~QGLContextGroupResource (this=0xd8ed10, __in_chrg=<optimized out>) at ../../src/opengl/qgl_p.h:768
#10 0x00007fffe9da5b4a in QGLContextGroupResource<QGLEngineSharedShaders>::~QGLContextGroupResource (this=0xd8ed10, __in_chrg=<optimized out>) at ../../src/opengl/qgl_p.h:772
#11 0x00007fffe9da5859 in qThreadStorage_deleteData<QGLContextGroupResource<QGLEngineSharedShaders> > (d=0xd8ed10) at ../../src/corelib/thread/qthreadstorage.h:97
#12 0x00007fffe9da50cf in QThreadStorage<QGLContextGroupResource<QGLEngineSharedShaders>*>::deleteData (x=0xd8ed10) at ../../src/corelib/thread/qthreadstorage.h:140
#13 0x00007ffff561545f in QThreadStorageData::finish (p=0x6ba6c8) at thread/qthreadstorage.cpp:203
#14 0x00007ffff570be2d in QCoreApplicationPrivate::~QCoreApplicationPrivate (this=0x6e8a10, __in_chrg=<optimized out>) at kernel/qcoreapplication.cpp:470
#15 0x00007ffff61776b9 in QApplicationPrivate::~QApplicationPrivate (this=0x6e8a10, __in_chrg=<optimized out>) at kernel/qapplication.cpp:222
#16 0x00007ffff61777fa in QApplicationPrivate::~QApplicationPrivate (this=0x6e8a10, __in_chrg=<optimized out>) at kernel/qapplication.cpp:226
#17 0x00007ffff571f571 in cleanup (pointer=<optimized out>) at ../../src/corelib/tools/qscopedpointer.h:62
#18 ~QScopedPointer (this=0x7fffffffd588, __in_chrg=<optimized out>) at ../../src/corelib/tools/qscopedpointer.h:100
#19 QObject::~QObject (this=0x7fffffffd580, __in_chrg=<optimized out>) at kernel/qobject.cpp:816
#20 0x00007ffff570ccdf in QCoreApplication::~QCoreApplication (this=0x7fffffffd580, __in_chrg=<optimized out>) at kernel/qcoreapplication.cpp:830
#21 0x00007ffff61799fc in QApplication::~QApplication (this=0x7fffffffd580, __in_chrg=<optimized out>) at kernel/qapplication.cpp:1098
#22 0x00000000004248b6 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kde-misc/kdiff3-0.9.97-r1/kdiff3-0.9.97/src-QT4/main.cpp:266

Perhaps of particular interest, here's the locals for QThreadStorageData::finish():
(gdb) frame 13
#13 0x00007ffff561545f in QThreadStorageData::finish (p=0x6ba6c8) at thread/qthreadstorage.cpp:203
203             destructor(q); //crash here might mean the thread exited after qthreadstorage was destroyed
(gdb) info locals
q = 0xd8ed10
i = 16
locker = {val = 7053424}
destructor = 0x7fffe9da50b2 <QThreadStorage<QGLContextGroupResource<QGLEngineSharedShaders>*>::deleteData(void*)>
tls = 0x6ba6c8
(gdb) info threads
  Id   Target Id         Frame 
  2    Thread 0x7fffe68d9700 (LWP 31750) "gdbus" 0x00007ffff4cc7d3f in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>)
    at ../sysdeps/unix/sysv/linux/poll.c:87
* 1    Thread 0x7ffff7f8b780 (LWP 31638) "kdiff3" XQueryExtension (dpy=dpy@entry=0x0, name=name@entry=0x7fffe9a9e394 "GLX", major_opcode=major_opcode@entry=0x7fffffffcef4, 
    first_event=first_event@entry=0x7fffffffcef8, first_error=first_error@entry=0x7fffffffcefc) at /usr/src/debug/x11-libs/libX11-1.5.0/libX11-1.5.0/src/QuExt.c:43

I'm rebuilding the rest of the qt libs (on gentoo) with USE="debug" and C/CXXFLAGS="-O1 -g3" and I'll see if I can come up with anything else, but I don't know QT at all and I'll probably end up downgrading so I can finish my other project.


Reproducible: Always

Steps to Reproduce:
1. start kdiff3
2. close kdiff3
Comment 1 Joachim Eibl 2012-12-31 10:13:44 UTC
Hi,

Is there a similar effect with other Qt-applications?

KDiff3 doesn't do anything OpenGL-specific.

Can you disable the use of OpenGL?

Do
export QT_GRAPHICSSYSTEM=raster
before starting KDiff3.

Joachim
Comment 2 Daniel Santos 2012-12-31 18:42:32 UTC
w00t! That works!  I'll try to get another KDE app to crash.  I'm pretty certain that Konversation has done it twice, but I haven't been able to reproduce it yet.  Thank you for the work-around though! Also, I'll try switching to another NVidia driver and see what happens, but I can't play with it until later tonight.
Comment 3 Christoph Feck 2013-01-06 02:01:53 UTC
If comment #1 works, you are using the OpenGL graphicssystem by default, which is marked as experimental in Qt*. As such, this bug report is invalid.

* see comment 18 at
http://hwoarang.silverarrow.org/2012/01/29/heads-up-how-to-set-your-default-graphics-engine-in-qt-4-8-0/