[rkward-tracker] [ rkward-Bugs-3327985 ] FIXED IN SVN: Crash when copying from R terminal

SourceForge.net noreply at sourceforge.net
Wed Jun 29 09:31:41 UTC 2011

Bugs item #3327985, was opened at 2011-06-24 18:03
Message generated for change (Comment added) made by nalimilan
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: CRASH
Status: Open
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Milan Bouchet-Valat (nalimilan)
Assigned to: Nobody/Anonymous (nobody)
>Summary: FIXED IN SVN: Crash when copying from R terminal

Initial Comment:
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 By: Milan Bouchet-Valat (nalimilan)
Date: 2011-06-29 11:31

Great, it's fixed! Very efficient!


Comment By: Thomas Friedrichsmeier (tfry)
Date: 2011-06-26 20:06

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



Comment By: Milan Bouchet-Valat (nalimilan)
Date: 2011-06-25 20:10

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


Comment By: Thomas Friedrichsmeier (tfry)
Date: 2011-06-25 12:47

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 .



Comment By: Milan Bouchet-Valat (nalimilan)
Date: 2011-06-24 23:31

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 By: Thomas Friedrichsmeier (tfry)
Date: 2011-06-24 20:17


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?



You can respond by visiting: 

More information about the rkward-tracker mailing list