Re: GtkLayout, segfaulting with [hv]adjustment properties

jacob berkman <jacob ximian com> writes:

> On Wed, 2001-11-14 at 16:03, Owen Taylor wrote:
> > 
> > jacob berkman <jacob ximian com> writes:
> > 
> > > i am getting a segfault in GtkLayout if i set the height/width
> > > properties before [hv]adjustment properties.
> > 
> > One sketch of a solution would be to:
> > 
> >  * If NULL adjustments are set during construction, don't create
> >    adjustments
> > 
> >  * Create default adjustments in a constructor() methods if
> >    hadjustment, vadjustment are NULL.
> do you have a nice way of differentiating between the adjustments being
> NULL from the _init() function and from construct-time parameters?  is
> initializing them to -1 in _init() too gross?

I was thinking of setting a boolean flag in the init that is cleared
in the constructor ... if you got rid of the unused freeze_count
field, it wouldn't make the structure any bigger. ;-)

Initializing them to GUINT_TO_POINTER(1) would also be acceptable,
though I'd probably do:


And you'd have to make sure that you never returned such a value
to the user. (We assume elsewhere that the first page of memory
is not used for pointers, and this is a pretty safe portable 
assumption. I can't vouch for the safety of GUINT_TO_POINTER(-1))

The flag seems a little cleaner to me.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]