shared lib: conversion-lib in Plasma

Petri Damstén petri.damsten at gmail.com
Mon Jul 27 13:13:25 BST 2009


On Sunday 26 July 2009 23:48:23 Aaron J. Seigo wrote:
> On Sunday 26 July 2009, Petri Damstén wrote:
> > On Friday 24 July 2009 00:24:29 Aaron J. Seigo wrote:
> > > >  * Do you really need Unit being a QObject?
> > >
> > > it's apparently used for memory management, but it's parented to the
> > > Converter singleton so they will live for the lifetime of the
> > > application -> not so good. will fix....
> >
> > Unit must live for the lifetime of the application. UnitCategory uses
> > those to do the actual conversion and has two maps String > Unit and Enum
> > > Unit. If unit class is deleted you cannot convert to that unit again.
>
> that's not really acceptable for apps that do occassional conversion.
> having memory hanging around because someone creates a conversion plasmoid
> and then closes it (or does similarly in krunner) isn't good.
>
> instead of a straight singleton, perhaps it could provide reference counted
> access so that the units can actually be cleared once there are no further
> users of it.

Hmm, yes maybe it would be easier to just use KUnitConversion::Value and add 
convertTo function to it and then when last value is deleted delete also unit 
categories. Converter class would be just private to the lib. Well I have to 
see. This might take some time though since it's 25.6C and days like this are 
not very common in Finland (There are more than plenty of cold and dark days 
at winter time for coding...)

Petri




More information about the kde-core-devel mailing list