Re-sorting FBL_ArraySet?

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Dec 1 10:15:11 CST 2003


on 12/1/03 8:56 AM, Arthur Clemens at aclemens at xs4all.nl wrote:

>>> and in DisplaySet.mm:
>>> 
>>> - (void)setShownSetToArraySet:(FBL_ArraySet*)arraySet
>>>    if (mShownSet != nil) {
>>>        delete mShownSet;
>>           ^^^^^^^^^^^^^^^^^^
>> 
>>     problem is here.
>> 
>> You try delete Array that Valentina already have delete!
> 
> Of course not: I'm checking if it is nil (that is NULL). So if it is
> deleted by the Sort function, it is not deleted a second time.

But you check mShownSet pointer.

C++ language has the next trap


    p1 = some object
    p2 = p1 

    delete p1;
    p1 = NULL;


    p2 still is not NULL !!!

    so if you try code as

    if( p2 )
        delete p2;  // CRASH!



> I find it strange that the sorted arraySet first counts 8 records, but
> after passing it as parameter suddenly has 0 records.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list