Bug 380727 - FIXED IN SVN: Crash when copying from R terminal
Summary: FIXED IN SVN: Crash when copying from R terminal
Status: RESOLVED FIXED
Alias: None
Product: rkward
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: RKWard Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-24 15:03 UTC by RKWard Team
Modified: 2011-10-24 07:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
-- Originally posted by (AT sourceforge.net): nalimilan -- Valgrind log shown after I click on Copy (16.63 KB, text/plain)
2011-06-25 17:04 UTC, RKWard Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RKWard Team 2011-06-24 15:03:23 UTC
-- Originally posted by (AT sourceforge.net): nalimilan --

-- This ticket was imported from http://sourceforge.net/p/rkward/bugs/90 on 2017-05-30 15:26:44 +0100 --
RKward from SVN as of today reliably crashes when trying to copy text from the R console. This is on Fedora 15, where Qt is 4.7.3 \(revision 6.fc15\).

\#0  QApplicationPrivate::dispatchEnterLeave \(enter=0x13871a0, 
leave=<optimized out>\) at kernel/qapplication.cpp:2805
\#1  0x00007ffff622eda7 in QApplication::x11ProcessEvent \(this=0x7fffffffd0c0, 
event=0x7fffffffcc60\) at kernel/qapplication\_x11.cpp:3660
\#2  0x00007ffff62562ec in x11EventSourceDispatch \(s=0x7a7160, callback=0, 
user\_data=0x0\) at kernel/qguieventdispatcher\_glib.cpp:148
\#3  0x0000003ffa8427ed in g\_main\_dispatch \(context=0x7a6a60\) at gmain.c:2441
\#4  g\_main\_context\_dispatch \(context=0x7a6a60\) at gmain.c:3014
\#5  0x0000003ffa842fc8 in g\_main\_context\_iterate \(context=0x7a6a60, 
block=<optimized out>, dispatch=1, self=<optimized out>\) at gmain.c:3092
\#6  0x0000003ffa84325c in g\_main\_context\_iteration \(context=0x7a6a60, 
may\_block=1\) at gmain.c:3155
\#7  0x00007ffff704fd0f in QEventDispatcherGlib::processEvents \(this=0x7a3440, 
flags=<optimized out>\) at kernel/qeventdispatcher\_glib.cpp:422
\#8  0x00007ffff6255fde in QGuiEventDispatcherGlib::processEvents \(
this=<optimized out>, flags=<optimized out>\)
at kernel/qguieventdispatcher\_glib.cpp:207
\#9  0x00007ffff70246c2 in QEventLoop::processEvents \(this=<optimized out>, 
flags=...\) at kernel/qeventloop.cpp:149
\#10 0x00007ffff70248bf in QEventLoop::exec \(this=0x7fffffffd030, flags=...\)
at kernel/qeventloop.cpp:201
\#11 0x00007ffff7028a07 in QCoreApplication::exec \(\)
at kernel/qcoreapplication.cpp:1008
\#12 0x0000000000432524 in main \(argc=<optimized out>, argv=<optimized out>\)
at /home/milan/Dev/rkward/rkward/rkward/main.cpp:177
Comment 1 Thomas Friedrichsmeier 2011-06-24 17:17:26 UTC
Hi\!

I cannot reproduce this. Could you give some more detail:
a\) There are a whole bunch of copy-actions: Copy selection literally, Copy commands only, and Copy lines to output. Which were you using? From the Edit->Menu? From the RMB context menu? Using a keyboard shortcut?
b\) Perhaps the content of the R console is relevant? Could you give an example that triggers the crash? Are you trying to copy everything, or only a specific range?

Regards
Thomas
Comment 2 Thomas Friedrichsmeier 2011-06-24 17:17:26 UTC
- **summary**: Crash when copying from R terminal --> NEEDINFO: Crash when copying from R terminal
Comment 3 RKWard Team 2011-06-24 20:31:05 UTC
-- Originally posted by (AT sourceforge.net): nalimilan --
I've found one important factor: it only happens when using focus follows mouse. I understood that by reading the part of the Qt code that crashes \(see below\).

About your questions: it happens when merely trying to copy a few chars using the Copy item from the top of the context menu of the terminal, or the Edit->Copy item. Copy to Output works, though. So the content of the terminal doesn't seem relevant.

I'm getting a Broken Install error dialog on start, but RKward works very well despite it, so I'm not sure it can be related \(how can I find out what exactly is broken in my installation?\).

2800	    //Whenever we leave an alien widget on X11, we need to reset its nativeParentWidget\(\)'s cursor.
2801	    // This is not required on Windows as the cursor is reset on every single mouse move.
2802	    QWidget \*parentOfLeavingCursor = 0;
2803	    for \(int i = 0; i < leaveList.size\(\); ++i\) \{
2804	        w = leaveList.at\(i\);
2805	        if \(\!isAlien\(w\)\)
2806	            break;
2807	        if \(w->testAttribute\(Qt::WA\_SetCursor\)\) \{
2808	            QWidget \*parent = w->parentWidget\(\);
2809	            while \(parent && parent->d\_func\(\)->data.in\_destructor\)
Comment 4 Thomas Friedrichsmeier 2011-06-25 09:47:57 UTC
Thanks for the additional info. I still cannot reproduce the problem, even when using Focus follows mouse.

The backtrace does not contain anything RKWard-related \(or even just KDE-related\), so it is quite likely that the bug is on a lower level. For starters, could you try, whether you can trigger similar crashes in the script editor \(try using "Copy" from the context menu\) or even in a standalone kwrite?

Since you seem to have some debugging skills, perhaps you could try running rkward through valgrind:
rkward --debugger valgrind
Quite likely, the root cause of the crash is simply not visible in the backtrace, but rather something went wrong shortly before, and then the next iteration of event processing crahes. Perhaps valgrind will give some better hints.

Regarding the message about a broken installation, this is \_probably\_ unrelated, but it's certainly a good idea to fix this, and thus rule out that this has anything to do with the problem. See the "troubleshooting" section on http://p.sf.net/rkward/faq .

Regards
Thomas
Comment 5 RKWard Team 2011-06-25 17:04:10 UTC
-- Originally posted by (AT sourceforge.net): nalimilan --
Valgrind log shown after I click on Copy
-- Created an attachment --
Comment 6 RKWard Team 2011-06-25 17:10:17 UTC
-- Originally posted by (AT sourceforge.net): nalimilan --
Copying in the script editor works OK, so that's not Kate's fault. Note it works well with RKward packaged in Fedora 15, and I built the SVN version with the same Qt, so that probably comes from a change in RKward.

I just discovered it also happens when clicking other menu items that don't bring up a dialog \(e.g. Erase\). You also need to have a script file open for the crash to happen. So that must come from a focus change issue: when you click on the Copy menu item, the menu closes and the mouse is over the script file, which gets focused. Maybe at that point RKward tries to unfocus the menu, which has already been destroyed?

See the attached Valgrind log, which shown many things happen just when I click on the Copy menu item. An interesting track is the delete called from RKWardMainWindow::partChanged\(\).
Comment 7 Thomas Friedrichsmeier 2011-06-26 17:06:08 UTC
Thanks for those additional hints. With this, I finally managed to reproduce the crash. For this, I had to create a situation, where the context menu would overlap with a second, inactive, window \(e.g. a script window\). Then, either
a\) moving the mouse into the second window, while the context menu is still shown, or
b\) selecting an action from the context menu which is positioned over the second window
would result in the crash. Problem was that this would activate the second window, which in turn would lead to the destruction of the context menu, while the context menu is still running its event loop.

I've fixed this in SVN. Please test, whether this also fixes the issue for you.

Regards
Thomas
Comment 8 Thomas Friedrichsmeier 2011-06-26 17:06:08 UTC
- **summary**: NEEDINFO: Crash when copying from R terminal --> NEEDS TESTING: Crash when copying from R terminal
Comment 9 RKWard Team 2011-06-29 08:31:41 UTC
-- Originally posted by (AT sourceforge.net): nalimilan --
Great, it's fixed\! Very efficient\!
Comment 10 RKWard Team 2011-06-29 08:31:41 UTC
-- Originally posted by (AT sourceforge.net): nalimilan --
- **summary**: NEEDS TESTING: Crash when copying from R terminal --> FIXED IN SVN: Crash when copying from R terminal
- **status**: open --> open-fixed
Comment 11 Thomas Friedrichsmeier 2011-10-24 07:13:22 UTC
- **status**: open-fixed --> closed-fixed