Home » Eclipse Projects » Standard Widget Toolkit (SWT) » javacore at org.eclipse.swt.internal.motif.OS.XmFontListNextEntry
javacore at org.eclipse.swt.internal.motif.OS.XmFontListNextEntry [message #448154] |
Tue, 04 January 2005 12:01 |
strus Messages: 113 Registered: July 2009 |
Senior Member |
|
|
Hi,
Trying to dynamically set my canvas to SWT.BOLd, I get the following JVM
crash.
3XMTHREADINFO "main" (TID:0x3009B9B8, sys_thread_t:0x3000C7A8,
state:R, native ID:0x1) prio=6
4XESTACKTRACE at
org.eclipse.swt.internal.motif.OS.XmFontListNextEntry(Native Method)
4XESTACKTRACE at
org.eclipse.swt.graphics.Font.getCodePage(Font.java(Compiled Code))
4XESTACKTRACE at
org.eclipse.swt.graphics.Font.motif_new(Font.java(Compiled Code))
4XESTACKTRACE at
org.eclipse.swt.graphics.GC.getFont(GC.java(Compiled Code))
4XESTACKTRACE at
com.ibm.perfwb.procmon.utils.vterm.VTermTerminal.setBold(VTe rmTerminal.java(Compiled
Code)) <=== this is my code
Here the increminated code (if the code put behind // is removed, the JVM
crashes). This piece of code is called from a paint method in a canvas.
The pGraphic is the event.gc object.
private void setBold(GC pGraphic, int pBold) {
Font normalFont = pGraphic.getFont();
FontData[] fds = normalFont.getFontData();
if (pBold != 0x000) {
for(int i=0; i<fds.length; i++)
{
fds[i].setStyle(SWT.BOLD);
}
//if (! normalFont.isDisposed())
// normalFont.dispose();
//normalFont= new Font(getCanvas().getDisplay(), fds);
pGraphic.setFont(normalFont);
} else {
for(int i=0; i<fds.length; i++)
{
fds[i].setStyle(SWT.NORMAL);
}
//if (! normalFont.isDisposed())
// normalFont.dispose();
//normalFont= new Font(getCanvas().getDisplay(), fds);
pGraphic.setFont(normalFont);
}
}
Eclipse 3.0
J2RE 1.4.1 IBM AIX build ca1411ifx-20040810 (141SR3)
OS: AIX 5.3
Architecture: PowerPC
SW: Motif
If you can help me ...
|
|
|
Re: javacore at org.eclipse.swt.internal.motif.OS.XmFontListNextEntry [message #448170 is a reply to message #448154] |
Tue, 04 January 2005 18:00 |
Steve Northover Messages: 1636 Registered: July 2009 |
Senior Member |
|
|
Are you disposing a font that you didn't create?
"strus" <strus_fr@yahoo.fr> wrote in message
news:cre0j5$l6v$1@www.eclipse.org...
> Hi,
>
> Trying to dynamically set my canvas to SWT.BOLd, I get the following JVM
> crash.
> 3XMTHREADINFO "main" (TID:0x3009B9B8, sys_thread_t:0x3000C7A8,
> state:R, native ID:0x1) prio=6
> 4XESTACKTRACE at
> org.eclipse.swt.internal.motif.OS.XmFontListNextEntry(Native Method)
> 4XESTACKTRACE at
> org.eclipse.swt.graphics.Font.getCodePage(Font.java(Compiled Code))
> 4XESTACKTRACE at
> org.eclipse.swt.graphics.Font.motif_new(Font.java(Compiled Code))
> 4XESTACKTRACE at
> org.eclipse.swt.graphics.GC.getFont(GC.java(Compiled Code))
> 4XESTACKTRACE at
>
com.ibm.perfwb.procmon.utils.vterm.VTermTerminal.setBold(VTe rmTerminal.java(
Compiled
> Code)) <=== this is my code
>
> Here the increminated code (if the code put behind // is removed, the JVM
> crashes). This piece of code is called from a paint method in a canvas.
> The pGraphic is the event.gc object.
>
> private void setBold(GC pGraphic, int pBold) {
>
> Font normalFont = pGraphic.getFont();
> FontData[] fds = normalFont.getFontData();
> if (pBold != 0x000) {
> for(int i=0; i<fds.length; i++)
> {
> fds[i].setStyle(SWT.BOLD);
> }
> //if (! normalFont.isDisposed())
> // normalFont.dispose();
> //normalFont= new Font(getCanvas().getDisplay(), fds);
> pGraphic.setFont(normalFont);
> } else {
> for(int i=0; i<fds.length; i++)
> {
> fds[i].setStyle(SWT.NORMAL);
> }
> //if (! normalFont.isDisposed())
> // normalFont.dispose();
> //normalFont= new Font(getCanvas().getDisplay(), fds);
> pGraphic.setFont(normalFont);
> }
> }
>
> Eclipse 3.0
> J2RE 1.4.1 IBM AIX build ca1411ifx-20040810 (141SR3)
> OS: AIX 5.3
> Architecture: PowerPC
> SW: Motif
>
> If you can help me ...
>
|
|
|
Re: javacore at org.eclipse.swt.internal.motif.OS.XmFontListNextEntry [message #448172 is a reply to message #448170] |
Tue, 04 January 2005 18:08 |
strus Messages: 113 Registered: July 2009 |
Senior Member |
|
|
You are right, it seems that my piece of code is wrong.
I will replace it by:
Font currentFont = pGraphic.getFont();
....
Font normalFont= new Font(getCanvas().getDisplay(), fds);
pGraphic.setFont(normalFont);
normalFont.dispose();
Could I dispose the normalFont just after assiging it to the pGraphic ?
do you agree ?
Steve Northover wrote:
> Are you disposing a font that you didn't create?
>
> "strus" <strus_fr@yahoo.fr> wrote in message
> news:cre0j5$l6v$1@www.eclipse.org...
>
>>Hi,
>>
>>Trying to dynamically set my canvas to SWT.BOLd, I get the following JVM
>>crash.
>>3XMTHREADINFO "main" (TID:0x3009B9B8, sys_thread_t:0x3000C7A8,
>>state:R, native ID:0x1) prio=6
>>4XESTACKTRACE at
>> org.eclipse.swt.internal.motif.OS.XmFontListNextEntry(Native Method)
>>4XESTACKTRACE at
>> org.eclipse.swt.graphics.Font.getCodePage(Font.java(Compiled Code))
>>4XESTACKTRACE at
>>org.eclipse.swt.graphics.Font.motif_new(Font.java(Compiled Code))
>>4XESTACKTRACE at
>>org.eclipse.swt.graphics.GC.getFont(GC.java(Compiled Code))
>>4XESTACKTRACE at
>>
>
> com.ibm.perfwb.procmon.utils.vterm.VTermTerminal.setBold(VTe rmTerminal.java(
> Compiled
>
>>Code)) <=== this is my code
>>
>>Here the increminated code (if the code put behind // is removed, the JVM
>>crashes). This piece of code is called from a paint method in a canvas.
>>The pGraphic is the event.gc object.
>>
>>private void setBold(GC pGraphic, int pBold) {
>>
>> Font normalFont = pGraphic.getFont();
>> FontData[] fds = normalFont.getFontData();
>> if (pBold != 0x000) {
>> for(int i=0; i<fds.length; i++)
>>{
>> fds[i].setStyle(SWT.BOLD);
>>}
>> //if (! normalFont.isDisposed())
>> // normalFont.dispose();
>> //normalFont= new Font(getCanvas().getDisplay(), fds);
>> pGraphic.setFont(normalFont);
>>} else {
>> for(int i=0; i<fds.length; i++)
>> {
>> fds[i].setStyle(SWT.NORMAL);
>> }
>> //if (! normalFont.isDisposed())
>>// normalFont.dispose();
>> //normalFont= new Font(getCanvas().getDisplay(), fds);
>> pGraphic.setFont(normalFont);
>>}
>>}
>>
>>Eclipse 3.0
>>J2RE 1.4.1 IBM AIX build ca1411ifx-20040810 (141SR3)
>>OS: AIX 5.3
>>Architecture: PowerPC
>>SW: Motif
>>
>>If you can help me ...
>>
>
>
>
|
|
|
Re: javacore at org.eclipse.swt.internal.motif.OS.XmFontListNextEntry [message #448192 is a reply to message #448172] |
Wed, 05 January 2005 14:55 |
Steve Northover Messages: 1636 Registered: July 2009 |
Senior Member |
|
|
Nope. Dispose of the font when no other object is using it and don't
dispose of fonts that you did not create.
"strus" <strus_fr@yahoo.fr> wrote in message
news:crem81$2av$1@www.eclipse.org...
> You are right, it seems that my piece of code is wrong.
> I will replace it by:
>
> Font currentFont = pGraphic.getFont();
> ...
> Font normalFont= new Font(getCanvas().getDisplay(), fds);
> pGraphic.setFont(normalFont);
> normalFont.dispose();
>
> Could I dispose the normalFont just after assiging it to the pGraphic ?
>
> do you agree ?
>
> Steve Northover wrote:
> > Are you disposing a font that you didn't create?
> >
> > "strus" <strus_fr@yahoo.fr> wrote in message
> > news:cre0j5$l6v$1@www.eclipse.org...
> >
> >>Hi,
> >>
> >>Trying to dynamically set my canvas to SWT.BOLd, I get the following JVM
> >>crash.
> >>3XMTHREADINFO "main" (TID:0x3009B9B8, sys_thread_t:0x3000C7A8,
> >>state:R, native ID:0x1) prio=6
> >>4XESTACKTRACE at
> >> org.eclipse.swt.internal.motif.OS.XmFontListNextEntry(Native Method)
> >>4XESTACKTRACE at
> >> org.eclipse.swt.graphics.Font.getCodePage(Font.java(Compiled Code))
> >>4XESTACKTRACE at
> >>org.eclipse.swt.graphics.Font.motif_new(Font.java(Compiled Code))
> >>4XESTACKTRACE at
> >>org.eclipse.swt.graphics.GC.getFont(GC.java(Compiled Code))
> >>4XESTACKTRACE at
> >>
> >
> >
com.ibm.perfwb.procmon.utils.vterm.VTermTerminal.setBold(VTe rmTerminal.java(
> > Compiled
> >
> >>Code)) <=== this is my code
> >>
> >>Here the increminated code (if the code put behind // is removed, the
JVM
> >>crashes). This piece of code is called from a paint method in a canvas.
> >>The pGraphic is the event.gc object.
> >>
> >>private void setBold(GC pGraphic, int pBold) {
> >>
> >> Font normalFont = pGraphic.getFont();
> >> FontData[] fds = normalFont.getFontData();
> >> if (pBold != 0x000) {
> >> for(int i=0; i<fds.length; i++)
> >>{
> >> fds[i].setStyle(SWT.BOLD);
> >>}
> >> //if (! normalFont.isDisposed())
> >> // normalFont.dispose();
> >> //normalFont= new Font(getCanvas().getDisplay(), fds);
> >> pGraphic.setFont(normalFont);
> >>} else {
> >> for(int i=0; i<fds.length; i++)
> >> {
> >> fds[i].setStyle(SWT.NORMAL);
> >> }
> >> //if (! normalFont.isDisposed())
> >>// normalFont.dispose();
> >> //normalFont= new Font(getCanvas().getDisplay(), fds);
> >> pGraphic.setFont(normalFont);
> >>}
> >>}
> >>
> >>Eclipse 3.0
> >>J2RE 1.4.1 IBM AIX build ca1411ifx-20040810 (141SR3)
> >>OS: AIX 5.3
> >>Architecture: PowerPC
> >>SW: Motif
> >>
> >>If you can help me ...
> >>
> >
> >
> >
|
|
|
Re: javacore at org.eclipse.swt.internal.motif.OS.XmFontListNextEntry [message #448202 is a reply to message #448192] |
Wed, 05 January 2005 17:12 |
strus Messages: 113 Registered: July 2009 |
Senior Member |
|
|
I try the following piece of code which does not work :
.... in the paint method of the canvas ...
setBold(event.gc);
.... later in the same class
public void setBold(GC pGRaphics) {
Font currentFont = pGraphic.getFont();
FontData[] fds = currentFont.getFontData();
for(int i=0; i<fds.length; i++)
{
fds[i].setStyle(SWT.BOLD);
}
Font normalFont= new Font(getCanvas().getDisplay(), fds);
pGraphic.setFont(normalFont);
}
This piece of code is called in a Paint event event of the Canvas
retrieve with getCanvas().
Could you tell me if the font has to be assigned to the GC or to the
canvas itself or to both ??
Must I build a new Font when I just want to change the style of an
already existing font ?
Tks.
Steve Northover wrote:
> Nope. Dispose of the font when no other object is using it and don't
> dispose of fonts that you did not create.
>
> "strus" <strus_fr@yahoo.fr> wrote in message
> news:crem81$2av$1@www.eclipse.org...
>
>>You are right, it seems that my piece of code is wrong.
>>I will replace it by:
>>
>>Font currentFont = pGraphic.getFont();
>>...
>>Font normalFont= new Font(getCanvas().getDisplay(), fds);
>>pGraphic.setFont(normalFont);
>>normalFont.dispose();
>>
>>Could I dispose the normalFont just after assiging it to the pGraphic ?
>>
>>do you agree ?
>>
>>Steve Northover wrote:
>>
>>>Are you disposing a font that you didn't create?
>>>
>>>"strus" <strus_fr@yahoo.fr> wrote in message
>>>news:cre0j5$l6v$1@www.eclipse.org...
>>>
>>>
>>>>Hi,
>>>>
>>>>Trying to dynamically set my canvas to SWT.BOLd, I get the following JVM
>>>>crash.
>>>>3XMTHREADINFO "main" (TID:0x3009B9B8, sys_thread_t:0x3000C7A8,
>>>>state:R, native ID:0x1) prio=6
>>>>4XESTACKTRACE at
>>>> org.eclipse.swt.internal.motif.OS.XmFontListNextEntry(Native Method)
>>>>4XESTACKTRACE at
>>>> org.eclipse.swt.graphics.Font.getCodePage(Font.java(Compiled Code))
>>>>4XESTACKTRACE at
>>>>org.eclipse.swt.graphics.Font.motif_new(Font.java(Compiled Code))
>>>>4XESTACKTRACE at
>>>>org.eclipse.swt.graphics.GC.getFont(GC.java(Compiled Code))
>>>>4XESTACKTRACE at
>>>>
>>>
>>>
> com.ibm.perfwb.procmon.utils.vterm.VTermTerminal.setBold(VTe rmTerminal.java(
>
>>>Compiled
>>>
>>>
>>>>Code)) <=== this is my code
>>>>
>>>>Here the increminated code (if the code put behind // is removed, the
>
> JVM
>
>>>>crashes). This piece of code is called from a paint method in a canvas.
>>>>The pGraphic is the event.gc object.
>>>>
>>>>private void setBold(GC pGraphic, int pBold) {
>>>>
>>>> Font normalFont = pGraphic.getFont();
>>>> FontData[] fds = normalFont.getFontData();
>>>> if (pBold != 0x000) {
>>>> for(int i=0; i<fds.length; i++)
>>>>{
>>>> fds[i].setStyle(SWT.BOLD);
>>>>}
>>>> //if (! normalFont.isDisposed())
>>>> // normalFont.dispose();
>>>> //normalFont= new Font(getCanvas().getDisplay(), fds);
>>>> pGraphic.setFont(normalFont);
>>>>} else {
>>>> for(int i=0; i<fds.length; i++)
>>>> {
>>>> fds[i].setStyle(SWT.NORMAL);
>>>> }
>>>> //if (! normalFont.isDisposed())
>>>>// normalFont.dispose();
>>>> //normalFont= new Font(getCanvas().getDisplay(), fds);
>>>> pGraphic.setFont(normalFont);
>>>>}
>>>>}
>>>>
>>>>Eclipse 3.0
>>>>J2RE 1.4.1 IBM AIX build ca1411ifx-20040810 (141SR3)
>>>>OS: AIX 5.3
>>>>Architecture: PowerPC
>>>>SW: Motif
>>>>
>>>>If you can help me ...
>>>>
>>>
>>>
>>>
>
>
|
|
|
Re: javacore at org.eclipse.swt.internal.motif.OS.XmFontListNextEntry [message #448253 is a reply to message #448202] |
Thu, 06 January 2005 09:42 |
strus Messages: 113 Registered: July 2009 |
Senior Member |
|
|
Ok, I found the good piece of code. It works now.
Thanks a lot.
strus wrote:
> I try the following piece of code which does not work :
> .... in the paint method of the canvas ...
> setBold(event.gc);
> .... later in the same class
> public void setBold(GC pGRaphics) {
> Font currentFont = pGraphic.getFont();
> FontData[] fds = currentFont.getFontData();
> for(int i=0; i<fds.length; i++)
> {
> fds[i].setStyle(SWT.BOLD);
> }
> Font normalFont= new Font(getCanvas().getDisplay(), fds);
> pGraphic.setFont(normalFont);
> }
> This piece of code is called in a Paint event event of the Canvas
> retrieve with getCanvas().
> Could you tell me if the font has to be assigned to the GC or to the
> canvas itself or to both ??
> Must I build a new Font when I just want to change the style of an
> already existing font ?
> Tks.
> Steve Northover wrote:
>> Nope. Dispose of the font when no other object is using it and don't
>> dispose of fonts that you did not create.
>>
>> "strus" <strus_fr@yahoo.fr> wrote in message
>> news:crem81$2av$1@www.eclipse.org...
>>
>>>You are right, it seems that my piece of code is wrong.
>>>I will replace it by:
>>>
>>>Font currentFont = pGraphic.getFont();
>>>...
>>>Font normalFont= new Font(getCanvas().getDisplay(), fds);
>>>pGraphic.setFont(normalFont);
>>>normalFont.dispose();
>>>
>>>Could I dispose the normalFont just after assiging it to the pGraphic ?
>>>
>>>do you agree ?
>>>
>>>Steve Northover wrote:
>>>
>>>>Are you disposing a font that you didn't create?
>>>>
>>>>"strus" <strus_fr@yahoo.fr> wrote in message
>>>>news:cre0j5$l6v$1@www.eclipse.org...
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>Trying to dynamically set my canvas to SWT.BOLd, I get the following JVM
>>>>>crash.
>>>>>3XMTHREADINFO "main" (TID:0x3009B9B8, sys_thread_t:0x3000C7A8,
>>>>>state:R, native ID:0x1) prio=6
>>>>>4XESTACKTRACE at
>>>>> org.eclipse.swt.internal.motif.OS.XmFontListNextEntry(Native Method)
>>>>>4XESTACKTRACE at
>>>>> org.eclipse.swt.graphics.Font.getCodePage(Font.java(Compiled Code))
>>>>>4XESTACKTRACE at
>>>>>org.eclipse.swt.graphics.Font.motif_new(Font.java(Compiled Code))
>>>>>4XESTACKTRACE at
>>>>>org.eclipse.swt.graphics.GC.getFont(GC.java(Compiled Code))
>>>>>4XESTACKTRACE at
>>>>>
>>>>
>>>>
>> com.ibm.perfwb.procmon.utils.vterm.VTermTerminal.setBold(VTe rmTerminal.java(
>>
>>>>Compiled
>>>>
>>>>
>>>>>Code)) <=== this is my code
>>>>>
>>>>>Here the increminated code (if the code put behind // is removed, the
>>
>> JVM
>>
>>>>>crashes). This piece of code is called from a paint method in a canvas.
>>>>>The pGraphic is the event.gc object.
>>>>>
>>>>>private void setBold(GC pGraphic, int pBold) {
>>>>>
>>>>> Font normalFont = pGraphic.getFont();
>>>>> FontData[] fds = normalFont.getFontData();
>>>>> if (pBold != 0x000) {
>>>>> for(int i=0; i<fds.length; i++)
>>>>>{
>>>>> fds[i].setStyle(SWT.BOLD);
>>>>>}
>>>>> //if (! normalFont.isDisposed())
>>>>> // normalFont.dispose();
>>>>> //normalFont= new Font(getCanvas().getDisplay(), fds);
>>>>> pGraphic.setFont(normalFont);
>>>>>} else {
>>>>> for(int i=0; i<fds.length; i++)
>>>>> {
>>>>> fds[i].setStyle(SWT.NORMAL);
>>>>> }
>>>>> //if (! normalFont.isDisposed())
>>>>>// normalFont.dispose();
>>>>> //normalFont= new Font(getCanvas().getDisplay(), fds);
>>>>> pGraphic.setFont(normalFont);
>>>>>}
>>>>>}
>>>>>
>>>>>Eclipse 3.0
>>>>>J2RE 1.4.1 IBM AIX build ca1411ifx-20040810 (141SR3)
>>>>>OS: AIX 5.3
>>>>>Architecture: PowerPC
>>>>>SW: Motif
>>>>>
>>>>>If you can help me ...
>>>>>
>>>>
>>>>
>>>>
>>
>>
|
|
|
Goto Forum:
Current Time: Sat Apr 20 04:05:11 GMT 2024
Powered by FUDForum. Page generated in 0.03761 seconds
|