Bug 169881

Summary: When javascript debugger enabled, Konqueror does not exit upon "File->Quit"
Product: [Applications] konqueror Reporter: Hugh Daschbach <hdasch>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, kevin.kofler, maksim, than
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Hugh Daschbach 2008-08-26 20:52:41 UTC
Version:            (using Devel)
Compiler:          gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7) Target: x86_64-linux-gnu
OS:                Linux
Installed from:    Compiled sources

This looked a lot like bug 167826, but that has been fixed an this issues persists.

With the javascript debugger enabled, konqueror will not exit after the main window is closed or after file->quit is selected.  The easiest way to see this is start "konqueror http://www.kde.org/" from a konsole window.  Then File->Quit once the window displays.  If the javascript debugger is disabled before launch, control will return to the konsole command prompt.  If the debugger was enabled, no command prompt until the konqueror process is killed (e.g., SIGINT).

gdb indicates that the process is idle in the event loop (QEventDispatcherGlib::processEvents) and friends.

kglobal::s_refCount == 1, indicating a reference accounting issue.

Adding a bit of debugging code indicates that the reference count gets bumped as part of DebugWindow::DebugWindow -> KXmlGuiWindow::KXmlGuiWindow -> KMainWindow::KMainWindow.

But the DebugWindow dtor never seems to be called to decrement the reference.

So how and where should the DebugWindow instance be torn down?
Comment 1 Maksim Orlovich 2008-08-26 21:26:43 UTC
Great analysis, thanks. I guess we can make KJSProxy refcount the DebugWindow?
Comment 2 Maksim Orlovich 2008-08-26 22:18:11 UTC
Ahahahah, fun fact: disabling debugging actually doesn't disable it for parts where it was active before.

Not so fun fact: fixing that will require some excessive mental dexterity from me.
Comment 3 George Kiagiadakis 2008-08-26 22:51:55 UTC
*** Bug 168216 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Orlovich 2008-08-26 23:20:15 UTC
Fixed in http://lists.kde.org/?l=kde-commits&m=121978525732664&w=2.
Thanks again for diagnosing it.
Comment 5 Kevin Kofler 2008-09-16 23:19:34 UTC
Unfortunately, this patch makes the problem worse, it causes this:
http://bugs.kde.org/show_bug.cgi?id=170461
http://bugs.kde.org/show_bug.cgi?id=167826#c37
i.e. it makes Konqueror no longer terminate in regular use, without the JavaScript debugger. (This was suspected by George Kiagiadakis in http://bugs.kde.org/show_bug.cgi?id=167826#c42 and Than Ngo did some tests which confirm it.) Therefore we will have to revert this patch in the Fedora KDE 4.1.1 packages.
Comment 6 Maksim Orlovich 2008-09-17 15:23:41 UTC
I cannot reproduce your report, and code inspection does not show anything wrong.
Comment 7 Kevin Kofler 2008-09-17 15:28:49 UTC
But at least 2 people on this bug tracker (see bug 170461 and bug 170517) as well as several Fedora users (3 of us KDE packagers and a few regular users) can reproduce it, and at least for the 3 package maintainers (we don't have feedback from the regular users yet), reverting your patch fixes it. Have you looked at George Kiagiadakis's analysis in bug 170461?
Comment 8 Maksim Orlovich 2008-09-17 15:31:52 UTC
Well, other people reproducing it doesn't make it possible for me to fix it. 
I'll ask George for more info. 
Comment 9 Kevin Kofler 2008-09-22 07:29:20 UTC
Reclosing as the regression has been fixed, so the patch can stay.