Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 21805 invoked from network); 18 Sep 2007 15:24:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Sep 2007 15:24:06 -0000 Received: (qmail 4002 invoked by uid 500); 18 Sep 2007 15:23:58 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 3973 invoked by uid 500); 18 Sep 2007 15:23:58 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 3964 invoked by uid 99); 18 Sep 2007 15:23:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2007 08:23:58 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2007 15:25:59 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 88CB6714204 for ; Tue, 18 Sep 2007 08:23:43 -0700 (PDT) Message-ID: <32612680.1190129023549.JavaMail.jira@brutus> Date: Tue, 18 Sep 2007 08:23:43 -0700 (PDT) From: "Chunrong Lai (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-4803) [classlib][awt] firepropertyChange only when it really change? In-Reply-To: <160821.1190020712095.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-4803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528411 ] Chunrong Lai commented on HARMONY-4803: --------------------------------------- It is understandable that RI also repaint when setBackground. Below class MyPanel introduces dead loop (with a changing background color) both in RI and Harmony. class MyPanel extends Panel{ int flag = 0 ; public void paint(Graphics g){ if(flag==0){ setBackground(Color.green) ; flag++ ; } else if(flag==1){ setBackground(Color.red) ; flag++ ; } else if(flag==2){ setBackground(Color.blue) ; flag=0 ; } System.out.println ("hi") ; } } But for the original test, Harmony does avoid the dead loop by color comparison. > [classlib][awt] firepropertyChange only when it really change? > -------------------------------------------------------------- > > Key: HARMONY-4803 > URL: https://issues.apache.org/jira/browse/HARMONY-4803 > Project: Harmony > Issue Type: Bug > Components: Classlib > Environment: Win32 + Linux32 > Reporter: Chunrong Lai > Assignee: Alexei Zakharov > Attachments: H4803.fixedforeground.patch, H4803.fixedreproducer.patch > > > Below reproducer shows the reaint and firePropertyChange triggered from setBackground(). > Harmony falls into a dead loop setBackground()->repaint()->update()->paint()->setBackground(). > It is easy to break the loop if we only repaint (and firepropertyChange) when the old background does not equal to the new background. > I believe there are other similar issues like this. > import java.awt.* ; > import java.awt.event.* ; > > class MyPanel extends Panel{ > int flag = 0 ; > > public void paint(Graphics g){ > setBackground(Color.blue) ; > System.out.println ("hi") ; > } > } > > public class MyFrame extends Frame{ > MyFrame(){ > add(new MyPanel()) ; > setSize(300,200) ; > setVisible(true) ; > } > public static void main(String args[]){ > new MyFrame() ; > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.