Patch: fix intermittent crash in KHTML Thai Word Break

David Faure faure at kde.org
Mon Feb 28 19:12:07 GMT 2005


On Monday 28 February 2005 20:09, Germain Garand wrote:
> Le lundi 28 Février 2005 17:20, David Faure a écrit :
> > On Monday 28 February 2005 18:24, Germain Garand wrote:
> > > Oh I see...  there is no proper initialization for th_brk.
> > > So then the only needed change should be:
> > > - static th_brk_def th_brk;
> > > + static th_brk_def th_brk = 0;
> >
> > AFAIK file-static data is initialized to 0 automatically.
> 
> ah, I didn't know that... but initialization of statics would only happens 
> once, when a library is dynamically loaded, no?
Right.

> some times ago we had a bug in the arena allocator, where if the last part was 
> unloaded and KHTMLFactory destroyed, static variables remain, so next time a 
> KHTMLPart was created, statics were not reinitialized.
Yes so the initialization should be done in some ctor - not in the above line.

> This would explain (what looks like) invalid reads on the cache structure...
> 
>     void cleanup_thaibreaks()
>     {
>         delete cache;
> +        cache = 0;
>     }

That looks correct.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kfm-devel mailing list