Thanks, but no luck. The application dies before the "root-scope" is
left, so there is no parent yet and the if-block that would cause the
parent recursion isn't entered.
Anyway, I've removed every weak/un/owned keyword from the code to start
from the beginning. Since I only use GObject based classes, strings and
arrays of strings, shouldn't the worst case scenario be that I end up
with circular references that don't get freed? Instead the TreeNode's
add method now adds "empty" nodes (invalid string references I suppose).
I've made the generic TreeNode's add-method virtual and overrode it in
Variable so that I can print out the values. Now however, the Node
actually stores the values properly (for a while). Why? All I did was
copy and paste the generic's code and fill in the types, which is the
same Vala would do, right?
The strings are now lost after reading them a few of times (how? I don't
use a single owned keyword). I'll look into that when I get back from
work, but some general ideas on how to debug these issues properly would
be really appreciated. :-)
Regards,
Dennis
Am 28.08.2012 09:26, schrieb Nor Jaidi Tuah:
>> Scope is supposed to hold "variables" (strings) and "arrays of
>> variables" and provide capability to try and fetch these from parent
>> scopes if the variable is not defined in the current scope. It doesn't
>> even have to do that in the error case below.
>> Dumping "result" before return is reached yields corrupted strings.
>>
>> public class Scope: Object {
>>
>> protected weak Scope parent;
>> protected Variable local;
>> (...)
>> public string?[]? get_array(string uri) {
>>
>> string?[]? result = this.local.get_array(uri);
>>
>> if (result == null && this.parent != null) { //! result != null here
>>
>> result = this.parent.get_array(uri);
>> }
>>
>> //! at this point result values appear to be invalid
>>
>> return result;
>> }
>> (...)
>> }
> Perhaps "parent", being weak, is no longer referring
> to a valid object. Remove "weak" and see.
>
> Nice day
> Nor Jaidi Tuah
>
>
>
>
> PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you
> are neither the addressee (intended recipient) nor an authorised recipient of
> the addressee, and have received this message in error, please destroy this
> message (including attachments) and notify the sender immediately. STRICT
> PROHIBITION: This message, whether in part or in whole, should not be
> reviewed, retained, copied, reused, disclosed, distributed or used for any
> purpose whatsoever. Such unauthorised use may be unlawful and may contain
> material protected by the Official Secrets Act (Cap 153) of the Laws of
> Brunei Darussalam. DISCLAIMER: We/This Department/The Government of Brunei
> Darussalam, accept[s] no responsibility for loss or damage arising from the
> use of this message in any manner whatsoever. Our messages are checked for
> viruses but we do not accept liability for any viruses which may be
> transmitted in or with this message.
> _______________________________________________
> vala-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list