Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 435948

Summary: "pixman_region32_init_rect: Invalid rectangle passed" on StyledText#setTopIndex(1)/scroll
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: SWTAssignee: Sravan Kumar Lakkimsetti <sravankumarl>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, arunkumar.thondapu, elaskavaia.cdt, isk.sysgo, kirenpillay1, lufimtse, peter.kullmann, sravankumarl, Van.Lepthien, x_at_y_or_z, zanetu
Version: 4.4   
Target Milestone: 4.5 M3   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 441566    
Attachments:
Description Flags
Snippet.java none

Description Markus Keller CLA 2014-05-27 11:54:58 EDT
Created attachment 243558 [details]
Snippet.java

I20140526-2000, Ubuntu 12.04 32-bit

When you run the attached snippet [1], the following is written to syserr:

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

The problem seems to be that styledText.setTopIndex(1) eventually results in an OS call where the passed rectangle has width == -2 (the left margin of the StyledText) here:

	at org.eclipse.swt.internal.gtk.OS.gdk_window_invalidate_rect(OS.java:5864)
	at org.eclipse.swt.widgets.Control.redrawWidget(Control.java:3774)
	at org.eclipse.swt.widgets.Scrollable.redrawWidget(Scrollable.java:387)
	at org.eclipse.swt.widgets.Canvas.redrawWidget(Canvas.java:213)
	at org.eclipse.swt.widgets.Control.redraw(Control.java:3753)
	at org.eclipse.swt.custom.StyledText.scrollVertical(StyledText.java:8015)
	at org.eclipse.swt.custom.StyledText.setTopIndex(StyledText.java:10118)
	at snip.Snippet.main(Snippet.java:21)


[1] Original scenario: Run org.eclipse.ui.workbench.texteditor.tests.FindReplaceDialogTest#testFocusNotChangedWhenEnterPressed()
Comment 1 Sravan Kumar Lakkimsetti CLA 2014-10-01 08:01:38 EDT
This problem has been introduced as a part of this commit https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=873a9a76611be625b45716322ad5255e3ae4a6fc

Need to fix the assert problem in a different way
Comment 2 Sravan Kumar Lakkimsetti CLA 2014-10-07 02:24:37 EDT
In GTK 3 (I looked at the code for GTK 3.12) for the api gtk_widget_set_allocation or gtk_widget_size_allocate to work the widget has to be visible or it should be top level widget. 

Due to this reason the code 
+ if (OS.GTK3) {
+     OS.gtk_widget_set_visible(topHandle, true);
+ }

is required before calling gtk_widget_set_allocation. 

So we need to avoid sending negative values to gdk_window_invalidate_rect.

error check has been added in this gerrit patch
https://git.eclipse.org/r/34479
Comment 3 Sravan Kumar Lakkimsetti CLA 2014-10-07 07:52:13 EDT
The patch has been pushed to git through the commit https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=5630a091774a79a8abc13251bc46b8a2be1f6f8c
Comment 4 Kiren Pillay CLA 2015-07-06 10:12:54 EDT
I'm still experiencing this in the latest version of Mars, running Fedora 22.

Eclipse IDE for Java EE Developers	4.5.0.20150621-1200	epp.package.jee	null

Mars crashes on a regular basis.
Comment 5 cdman CLA 2015-07-16 03:56:16 EDT
I'm still experiencing this bug with Eclipse Mars (4.5.0, Build id: 20150621-1200) on Ubuntu 15.04 64 bit with OpenJDK 1.8.0_45-internal.

In addition the text in the package explorer sometimes has weird shadows (not sure if related or not).
Comment 6 nd Isk CLA 2015-08-27 09:21:36 EDT
Hi,

I'm also still experiencing this.

Triggered by:
- Any combo box click: combo box becomes unusable. There are no crashes caused by this though.

Workaround:
- use the keyboard to navigate the combo box.

%<-------------------------------------------------------------
OS: OpenSuse 13.2
KDE: 4.14.9
Eclipse Version: 4.5.0.v20150603-2331, Build id: I20150603-2000
%<-------------------------------------------------------------
Comment 7 Peter Kullmann CLA 2015-12-17 11:02:48 EST
My UI tests stopped working - they just hang with the message in the bug title. This happens for 4.5.1 on a SuSE Tumbleweed system. I don't know whether this is related to StyledText but the error message in the log is the same.
Comment 8 Markus Keller CLA 2015-12-18 07:19:19 EST
(In reply to all comments after comment #3)
If you can't reproduce the syserr message with the snippet from comment 0, then your problem is not this bug.

There are many ways pixman_region32_init_rect can produce this message, and unfortunately, we cannot do anything unless you can pinpoint where it happens. GTK doesn't produce a Java stacktrace, so we can't even start investigating.

Please file a new bug with steps to reproduce. An SWT snippet heavily increases chances for a fix.