4 Responses to “Two more bugfixes to KStars”

  1. arunchaganty said:

    Regd. the 2nd bug fix, doesn’t KDE have a mechanism for taking care of object references? Glib has g_object_ref and g_object_unref, for the same purpose. Also, without looking at the source, the ks_moon is a static *class* variable, does this mean KSMoon is a singleton class? (just out of curiousity), or possibly just the star data is…

  2. Akarsh Simha said:

    I don’t think the KDE API has such a mechanism. Actually, it wouldn’t be as important here, because we are using C++ and not C.
    KSMoon is not a singleton class, but has a few static members in it, that describe coeffecients of various terms in a sinusoidal series used to compute the moon’s position (I don’t know the details).
    Interestingly, this concept struck me because of my minor experience with GLib. g_object_ref and g_object_unref was what gave me the idea of adding a reference count.

  3. Gopala Krishna said:

    Though KDE doesn’t have the reference counting mechanism directly, its inherited from qt4.
    One of the mechanism is using QSharedData and QSharedDataPointer classes, although the classes primarily are for implicit sharing.

    Secondly, qt4.4 has uncovered its atomic api a bit, which helps in safe reference counting across threads. Here is a link
    http://doc.trolltech.com/4.4/qatomicint.html

  4. Akarsh Simha said:

    Ahh… while I think that QSharedDataPointer etc might help here, I think they are too much of an overkill for something as simple as we required here, as you said. Thanks for the information.

Leave a Reply