Bug 338012

Summary: Eclipse crashes in debug mode and using oxygen-gtk
Product: [Plasma] Oxygen Reporter: javicid
Component: gtk2-engineAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Status: RESOLVED FIXED    
Severity: crash CC: ansgar.radermacher, asraniel, b7.10110111, claudiolanconelli, daniel.armbrust.list, darose, hugo.pereira.da.costa, javicid, kde, loskutov, manuel.steurer, mparker, renszarv07, sskyman, web
Priority: NOR    
Version: 1.4.5   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: error report
gdb core backtrace
java crash log
patch that fixes the bug

Description javicid 2014-08-04 00:28:31 UTC
Created attachment 88096 [details]
error report

Eclipse eventually crashes when using the debug mode. The steps to reproduce it are:

1- Open Eclipse and launch debug mode.
2- Play around with the 'Variables' window (resume/pause the application, select variables, unfold things,...).

It happened using both Kepler and Luna, and here it is the message it outputs:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fa7e428d36a, pid=2628, tid=140360202917632
#
# JRE version: OpenJDK Runtime Environment (7.0_55-b14) (build 1.7.0_55-b14)
# Java VM: OpenJDK 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libgtk-x11-2.0.so.0+0x22036a]  gtk_tree_view_get_background_area+0x8a
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/javier/hs_err_pid2628.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Comment 1 Ansgar Radermacher 2014-09-02 21:27:37 UTC
I've had the same problem, the error happens quite often (every 2nd debug session). See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=421073.
Switching to the cleanlooks theme solved this problem - and apparently also frequent crashes of the vmware player (should that be posted as a separate bug?)
Comment 2 manuel.steurer 2014-10-22 07:13:00 UTC
Created attachment 89244 [details]
gdb core backtrace

A similar crash occurred with my Eclipse based rcp application On OpenSuse 13.1 with oxygen-gtk theme, I attached the backtrace that gdb gave for the core dump. Frame #8 is the crash site, frames 7 to 1 are just the usual java crash signal handling. Frames 9-14 are inside liboxygen-gtk.so.
Comment 3 manuel.steurer 2014-10-22 07:16:05 UTC
Created attachment 89245 [details]
java crash log

This is the java crash log from the same crash.
Comment 4 manuel.steurer 2014-10-22 07:19:24 UTC
*** This bug has been confirmed by popular vote. ***
Comment 5 Claudio 2014-10-30 01:22:27 UTC
I have the same issue on Kubuntu 14.04 64bit, Oracle jdk 1.7.0_72, Android adt-bundle-linux-x86_64-20140702 (based on Eclipse Juno), oxygen-gtk theme
Comment 6 Matt Whitlock 2017-03-31 11:16:09 UTC
I have been experiencing this crash for years and am still seeing it in Oxygen-Gtk2 1.4.6. Here is some more information.

#6  <signal handler called>
#7  0x00007f724774a012 in IA__gtk_tree_view_get_background_area (tree_view=tree_view@entry=0x7f72b9630b50, path=0x7f72b8a2cdb0, 
    column=0x7f72b92b5840, rect=rect@entry=0x7f72be2345b0) at ../../gtk+-2.24.31/gtk/gtktreeview.c:13035
#8  0x00007f7247434af5 in Oxygen::Gtk::CellInfo::backgroundRect (this=this@entry=0x7f72b9771320, 
    treeView=treeView@entry=0x7f72b9630b50) at ../../oxygen-gtk2-1.4.6/src/oxygengtkcellinfo.cpp:206
#9  0x00007f7247425fbd in Oxygen::TreeViewStateData::dirtyRect (this=this@entry=0x7f72b9771278)
    at ../../oxygen-gtk2-1.4.6/src/animations/oxygentreeviewstatedata.cpp:129
#10 0x00007f7247426130 in Oxygen::TreeViewStateData::delayedUpdate (pointer=0x7f72b9771278)
    at ../../oxygen-gtk2-1.4.6/src/animations/oxygentreeviewstatedata.cpp:176
#11 0x00007f7247425c89 in Oxygen::TreeViewStateData::updateState (this=this@entry=0x7f72b9771278, info=..., state=<optimized out>)
    at ../../oxygen-gtk2-1.4.6/src/animations/oxygentreeviewstatedata.cpp:91
#12 0x00007f7247403f0e in Oxygen::TreeViewStateEngine::get (this=0x7f72b83329d0, widget=<optimized out>, info=..., options=...)
    at ../../oxygen-gtk2-1.4.6/src/animations/oxygentreeviewstateengine.h:92
#13 0x00007f72474ad850 in Oxygen::draw_expander (style=<optimized out>, window=0x7f72b9d9ba20, state=<optimized out>, 
    clipRect=0x7f72be234840, widget=0x7f72b9630b50, detail=0x7f72477e0ba6 "treeview", x=6, y=10, 
    expanderStyle=GTK_EXPANDER_COLLAPSED) at ../../oxygen-gtk2-1.4.6/src/oxygenstylewrapper.cpp:2738
#14 0x00007f724773d6fa in gtk_tree_view_draw_arrow (tree_view=tree_view@entry=0x7f72b9630b50, tree=tree@entry=0x7f72b904d7d0, 
    node=node@entry=0x7f72b9335120, x=x@entry=0, y=y@entry=7) at ../../gtk+-2.24.31/gtk/gtktreeview.c:9576
#15 0x00007f7247743ba0 in do_prelight (tree_view=tree_view@entry=0x7f72b9630b50, tree=0x7f72b904d7d0, node=0x7f72b9335120, x=0, 
    y=7) at ../../gtk+-2.24.31/gtk/gtktreeview.c:3270
#16 0x00007f724774b134 in prelight_or_select (tree_view=tree_view@entry=0x7f72b9630b50, tree=<optimized out>, 
    node=<optimized out>, x=<optimized out>, y=<optimized out>) at ../../gtk+-2.24.31/gtk/gtktreeview.c:3320
#17 0x00007f724774da25 in gtk_tree_view_enter_notify (widget=widget@entry=0x7f72b9630b50, event=0x7f72b8f0bca0)
    at ../../gtk+-2.24.31/gtk/gtktreeview.c:5620

(gdb) frame 9
#9  0x00007f7247425fbd in Oxygen::TreeViewStateData::dirtyRect (this=this@entry=0x7f72b9771278)
    at ../../oxygen-gtk2-1.4.6/src/animations/oxygentreeviewstatedata.cpp:129
129                 const GdkRectangle previousRect( _previous._info.backgroundRect( treeView ) );

(gdb) frame 8
#8  0x00007f7247434af5 in Oxygen::Gtk::CellInfo::backgroundRect (this=this@entry=0x7f72b9771320,
    treeView=treeView@entry=0x7f72b9630b50) at ../../oxygen-gtk2-1.4.6/src/oxygengtkcellinfo.cpp:206
206             { gtk_tree_view_get_background_area( treeView, _path, _column, &out ); }

(gdb) frame 7
#7  0x00007f724774a012 in IA__gtk_tree_view_get_background_area (tree_view=tree_view@entry=0x7f72b9630b50, path=0x7f72b8a2cdb0,
    column=0x7f72b92b5840, rect=rect@entry=0x7f72be2345b0) at ../../gtk+-2.24.31/gtk/gtktreeview.c:13035
13035     g_return_if_fail (column == NULL || GTK_IS_TREE_VIEW_COLUMN (column));

(gdb) print *column
$1 = {parent = {parent_instance = {g_type_instance = {g_class = 0x3f0000003f000000}, ref_count = 0, qdata = 0xa}, flags = 0},
  tree_view = 0x0, button = 0x0, child = 0x7f72b8ac0180, arrow = 0x1, alignment = 0x7f72b8f0da30, window = 0x310fe0,
  editable_widget = 0xe00, xalign = 0, property_changed_signal = 0, spacing = -1185748944,
  column_type = (GTK_TREE_VIEW_COLUMN_FIXED | unknown: 32624), requested_width = 28, button_request = 25, resized_width = 96,
  width = 0, fixed_width = 28, min_width = 25, max_width = -1184045376, drag_x = 32626, drag_y = -1180018624, title = 0x0,
  cell_list = 0x0, sort_clicked_signal = 3093474752, sort_column_changed_signal = 32626, sort_column_id = -1188131744,
  sort_order = (unknown: 32626), visible = 0, resizable = 0, clickable = 0, dirty = 0, show_sort_indicator = 0,
  maybe_reordered = 0, reorderable = 0, use_resized_width = 0, expand = 0}

As you can see, Oxygen-Gtk is attempting to check that the Oxygen::Gtk::CellInfo::_column data member points to a valid GtkTreeViewColumn, but the referent of the pointer has already been freed, leaving a garbage address in g_class, which causes the G_TYPE_CHECK_INSTANCE_TYPE in GTK_IS_TREE_VIEW_COLUMN to segfault.

Probably Oxygen::Gtk::CellInfo should not be holding onto a pointer to a GtkTreeViewColumn instance without incrementing its reference count.
Comment 7 Matt Whitlock 2017-03-31 14:23:34 UTC
Created attachment 104832 [details]
patch that fixes the bug

I couldn't find a way to reference count the GtkTreeViewColumn without causing crashes in Gtk, but I did find a way to fix the bug by having Oxygen-Gtk remember the column index rather than a pointer to the column.
Comment 8 David Rosenstrauch 2017-04-06 13:29:25 UTC
IIRC, oxygen-gtk is no longer being supported.  (Since the upgrade to gtk3.)  So probably best to just bite the bullet and switch to a GTK3 supported theme, like adwaita.
Comment 9 Matt Whitlock 2017-04-06 13:35:56 UTC
(In reply to David Rosenstrauch from comment #8)
> IIRC, oxygen-gtk is no longer being supported.  (Since the upgrade to gtk3.)

GTK3 support in SWT (the GUI toolkit that Eclipse uses) is half-baked (lots of widgets appear unfinished), so I run Eclipse in GTK2 mode, which works perfectly now that I've fixed this bug in Oxygen-GTK2.

> So probably best to just bite the bullet and switch to a GTK3 supported
> theme, like adwaita.

Oxygen is not even an option for GTK3 theme on my system. I use Breeze as my GTK3 theme, but this is irrelevant to Eclipse running in GTK2 mode.
Comment 10 Hugo Pereira Da Costa 2017-04-06 15:33:37 UTC
Git commit ef3c0cdfa18a6f612e5ba84e42bcd288374669fb by Hugo Pereira Da Costa.
Committed on 06/04/2017 at 15:32.
Pushed by hpereiradacosta into branch 'master'.

Patch from Matt Whitlock to fix crash in ecclipse about invalid columns.

M  +32   -46   src/oxygengtkcellinfo.cpp
M  +14   -8    src/oxygengtkcellinfo.h

https://commits.kde.org/oxygen-gtk/ef3c0cdfa18a6f612e5ba84e42bcd288374669fb
Comment 11 Hugo Pereira Da Costa 2017-04-06 15:37:26 UTC
@Matt
Thanks for the patch.
Unfortunately, and as mentionned by David, oxygen-gtk (either 2 nor 3) are not supported any more (first because oxygen is not the default kde theme any more, second because of the gtk3 fiasco.)
In particular this means that there will not be any new release of oxygen-gtk2.

Still, your patch is much appreciated, and I have merged it to the code, and pushed it to the master branch.


Regards,

Hugo