[eclipse-linuxtools] Modify piechart patch to prevent premature disposal of fonts.

Jeff Johnston jjohnstn at fedoraproject.org
Wed Aug 6 19:18:57 UTC 2014


commit 7d3b0fd719966efbf4acf41e9344c6ad0490a2a3
Author: Jeff Johnston <jjohnstn at redhat.com>
Date:   Wed Aug 6 15:18:37 2014 -0400

    Modify piechart patch to prevent premature disposal of fonts.

 eclipse-linuxtools.spec |    7 +++-
 piechart.patch          |   80 +++++++++++++++++++++++++++++++++++-----------
 2 files changed, 66 insertions(+), 21 deletions(-)
---
diff --git a/eclipse-linuxtools.spec b/eclipse-linuxtools.spec
index 177de38..a15649a 100644
--- a/eclipse-linuxtools.spec
+++ b/eclipse-linuxtools.spec
@@ -5,7 +5,7 @@
 
 Name:           %{?scl_prefix}eclipse-linuxtools
 Version:        3.0.0
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Linux specific Eclipse plugins
 
 License:        EPL
@@ -141,7 +141,7 @@ All test bundles for the Linux Tools project.
 
 %patch0
 %patch1 -p1
-%patch2 -p1
+#%patch2 -p1
 %pom_remove_plugin org.jacoco:jacoco-maven-plugin
 %pom_disable_module lttng
 %pom_disable_module libhover
@@ -307,6 +307,9 @@ popd
 %{_javadir}/linuxtools-tests
 
 %changelog
+* Wed Aug 06 2014 Jeff Johnston <jjohnstn at redhat.com> 3.0.0-5
+- Modify piechart patch to prevent premature disposal of fonts.
+
 * Thu Jul 24 2014 Jeff Johnston <jjohnstn at redhat.com> 3.0.0-4
 - Fix piechart title centering for swt-chart 0.9 and higher.
 
diff --git a/piechart.patch b/piechart.patch
index ef74b1c..dfa1786 100644
--- a/piechart.patch
+++ b/piechart.patch
@@ -1,6 +1,18 @@
+diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF.fix ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF
+--- ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF.fix	2014-08-06 15:14:05.700850277 -0400
++++ ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF	2014-08-06 15:14:16.676044730 -0400
+@@ -6,7 +6,7 @@ Bundle-Version: 2.0.0.qualifier
+ Bundle-Vendor: %bundleProvider
+ Bundle-Localization: plugin
+ Require-Bundle: org.eclipse.ui,
+- org.swtchart
++ org.swtchart;bundle-version="0.9.0"
+ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+ Bundle-ActivationPolicy: lazy
+ Export-Package: org.eclipse.linuxtools.dataviewers.piechart
 diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java.fix ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java
---- ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java.fix	2014-07-10 18:51:13.692736718 -0400
-+++ ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java	2014-07-11 16:48:18.143203309 -0400
+--- ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java.fix	2014-08-06 15:10:24.583838639 -0400
++++ ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java	2014-08-06 15:11:41.721260565 -0400
 @@ -21,6 +21,7 @@ import org.swtchart.Chart;
  import org.swtchart.IAxis;
  import org.swtchart.IBarSeries;
@@ -23,8 +35,8 @@ diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse
          xAxis.enableCategory(true);
          xAxis.setCategorySeries(new String[]{""}); //$NON-NLS-1$
 diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java.fix ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java
---- ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java.fix	2014-07-10 13:14:44.350779682 -0400
-+++ ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java	2014-07-11 15:04:25.881118928 -0400
+--- ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java.fix	2014-08-06 15:10:31.248962584 -0400
++++ ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java	2014-08-06 15:12:37.674276098 -0400
 @@ -22,6 +22,7 @@ import org.eclipse.swt.widgets.Control;
  import org.eclipse.swt.widgets.Display;
  import org.swtchart.IBarSeries;
@@ -42,7 +54,19 @@ diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse
      /**
       * Handles drawing and updating of a PieChart, with titles given to its legend and
       * to each of its pies. Pies will be drawn in the given chart's plot area.
-@@ -70,7 +73,11 @@ public class PieChartPaintListener imple
+@@ -60,6 +63,7 @@ public class PieChartPaintListener imple
+         pieSliceAngles = new int[seriesValues.length][];
+         if (seriesValues.length == 0) {
+             bounds = gc.getClipping();
++            Font oldFont = gc.getFont();
+             Font font = new Font(Display.getDefault(), FONT, 15, SWT.BOLD);
+             gc.setForeground(BLACK);
+             gc.setFont(font);
+@@ -67,15 +71,21 @@ public class PieChartPaintListener imple
+             Point textSize = e.gc.textExtent(text);
+             gc.drawText(text, (bounds.width - textSize.x) / 2, (bounds.height - textSize.y) / 2);
+             font.dispose();
++            gc.setFont(oldFont);
              return;
          }
          bounds = plotArea.getBounds();
@@ -55,7 +79,21 @@ diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse
          int width = bounds.width / seriesValues.length;
          int x = bounds.x;
  
-@@ -92,10 +99,24 @@ public class PieChartPaintListener imple
+         if (chart.getLegend().isVisible()) {
+             Rectangle legendBounds = ((Control) chart.getLegend()).getBounds();
++            Font oldFont = gc.getFont();
+             Font font = new Font(Display.getDefault(), FONT, 10, SWT.BOLD);
+             gc.setForeground(BLACK);
+             gc.setFont(font);
+@@ -83,6 +93,7 @@ public class PieChartPaintListener imple
+             Point textSize = e.gc.textExtent(text);
+             gc.drawText(text, legendBounds.x + (legendBounds.width - textSize.x) / 2, legendBounds.y - textSize.y);
+             font.dispose();
++            gc.setFont(oldFont);
+         }
+ 
+         pieWidth = Math.min(width - X_GAP, bounds.height);
+@@ -92,10 +103,24 @@ public class PieChartPaintListener imple
          }
      }
  
@@ -79,20 +117,24 @@ diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse
 +    	String text = origTitleText;
 +    	for (int i = 0; i < numBlanks; ++i)
 +    		text += " "; //$NON-NLS-1$
-+    	title.setText(text);
 +    	pe.gc.setFont(oldFont);
++    	title.setText(text);
      }
  
      private void drawPieChart(PaintEvent e, int chartnum, Rectangle bounds) {
-diff -up ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF.fix ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF
---- ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF.fix	2014-07-24 15:16:15.210891124 -0400
-+++ ./profiling/org.eclipse.linuxtools.dataviewers.piechart/META-INF/MANIFEST.MF	2014-07-24 15:16:41.194324927 -0400
-@@ -6,7 +6,7 @@ Bundle-Version: 2.0.0.qualifier
- Bundle-Vendor: %bundleProvider
- Bundle-Localization: plugin
- Require-Bundle: org.eclipse.ui,
-- org.swtchart
-+ org.swtchart;bundle-version="0.9.0"
- Bundle-RequiredExecutionEnvironment: JavaSE-1.7
- Bundle-ActivationPolicy: lazy
- Export-Package: org.eclipse.linuxtools.dataviewers.piechart
+@@ -143,6 +168,7 @@ public class PieChartPaintListener imple
+             gc.drawLine(pieCenters[chartnum].x, pieCenters[chartnum].y, pieCenters[chartnum].x, pieCenters[chartnum].y - pieWidth / 2);
+         }
+ 
++        Font oldFont = gc.getFont();
+         Font font = new Font(Display.getDefault(), FONT, 12, SWT.BOLD);
+         gc.setForeground(BLACK);
+         gc.setBackground(WHITE);
+@@ -151,6 +177,7 @@ public class PieChartPaintListener imple
+         Point textSize = e.gc.textExtent(text);
+         gc.drawText(text, pieX + (pieWidth - textSize.x) / 2, pieY + pieWidth + textSize.y);
+         font.dispose();
++        gc.setFont(oldFont);
+     }
+ 
+     private void getPieSeriesArray() {


More information about the scm-commits mailing list