[bt-devel] close presenter bug

Kevin Miller bt-devel@crosswire.org
Wed, 6 Jun 2001 16:06:27 -0600 (MDT)


In the current CVS build of bibletime there is a bug in the
presenters that can cause a segfault when you choose NONE from the
module selection button.  I also saw the same behavior in the
beta1 build.  This happens for all of the
presenters--CBiblePresenter, CCommentaryPresenter, and
CLexiconPresenter.  Can anyone else verify this or is this some
strange behavior for my system.

If it is verifiable as a bug, I think I have a solution, but as I
am fairly new to KDE/QT development I am not sure if it is the
best solution or not.  Basically in CSwordPresenter.cpp if you
change the line:

CSwordPresenter::CSwordPresenter(ListCSwordModuleInfo useModules,
CImportantClasses* importantClasses,QWidget *parent, const char
*name ) : CPresenter(parent,name) {

to be:

CSwordPresenter::CSwordPresenter(ListCSwordModuleInfo useModules,
CImportantClasses* importantClasses,QWidget *parent, const char
*name ) : CPresenter(parent,name,0) {

fixes the problem.  The only change is sending in 0 as the widget
flag for the CPresenter which then gets used in the KMainWindow
constructor instead of the default WDestructiveClose.  From
kmainwindow.h it says:

 *  Note that a KMainWindow per-default is created with the
 *  WDestructiveClose flag, i.e. it is automatically destroyed when the
 *  window is closed. If you do not want this behavior, specify 0 as
 *  widget flag in the constructor.

By sending 0 in it thus avoids the destructive close behavior and
alleviates the segfault problem.  My biggest worry, being less
than well versed in the kde api, is that by not using
"destructive close" this is leaving objects and thus memory
around that are not getting cleaned up properly.

Any thoughts from those who are a little more knowledgable?  If
this isn't reproduceable on anyone else's builds, any thoughts as
to why I may be seeing it?  Thanks.

Kevin