Tk Library Source Code

View Ticket
Login
Ticket UUID: 1106375
Title: Widget Error on failed object's construction
Type: Bug Version: None
Submitter: aldobu Created on: 2005-01-20 23:49:44
Subsystem: snit Assigned To: duquette
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-06-05 04:09:20
Resolution: Fixed Closed By: duquette
    Closed on: 2005-06-04 21:09:20
Description:
** Widget Error: when an object's constructor fails, the 
object is not destroyed **


   Let's take the following example.
   Here's a widgetadaptor providing an extension of 
the 'label' widget.

package require snit 0.97
::snit::widgetadaptor mylabel {
   
   delegate method * to hull
   delegate option * to hull 

   constructor {args} {
      installhull using label
      $win configurelist $args
      puts "** $win created"
   }

   destructor {
      puts "** $win destroyed"
   }
}   

   when I (wrongly) create an instance 
   (for example, I use an unsupported option),
   the instance is not not destroyed !
  
mylabel .myL -strangeoption xyz

   the following error is correctly raised
  
** .myL destroyed
Error in constructor: unknown option "-strangeoption" 
 
   but the ".myL" object still exists !
   This is in contrast with 'standard' widgets, because if 
you write:
  
label .myL -strangeoption xyz
  
   then an error is raised and the object is not created.

I also experimented with 'widgetadaptor' ... the 
behaviour is still wrong.
Finally I experimented with 'type' ... the behaviour is 
correct.
User Comments: duquette added on 2005-06-05 04:09:20:
Logged In: YES 
user_id=372859

The bug affected snit::widgets as well as widgetadaptors.

andreas_kupries added on 2005-02-15 07:32:54:
Logged In: YES 
user_id=75003

Will, your opinion ?