SIGSEGV in invariant._d_invariant(Object)

Keywan Ghadami via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 6 15:36:21 PST 2016


On Wednesday, 6 January 2016 at 21:58:51 UTC, Adam D. Ruppe wrote:
> On Wednesday, 6 January 2016 at 21:50:23 UTC, Keywan Ghadami 
> wrote:
>> how to fix an SIGSEGV in invariant._d_invariant(Object)?
>
> That means you are calling a method on a null object.
>
> Your object might be at the bottom of the stack trace listing. 
> Check your code for a declared class that you forgot to use 
> `new` on, that's usually the cause with new users (in D, you 
> must explicitly new all classes you create.)

Hi thank you, i am glad to read that i can focus on the 
applicatin code, and that stacktrace. If i read that stack trace 
correctly the segfault happens while accessing a struct within 
the method of a class instance.

This instance is the object "_adapter" that can not be null 
please see the following code from line 512.

     @property int itemCount() {
         if (_adapter !is null)
             return _adapter.itemCount;
         return 0;
     }

could it be that this instance was deallocated from anonther 
thread, or can it really be be that the object was never created. 
if so than i do not understand why i do not get a SIGSEGV for the 
initial method call.





More information about the Digitalmars-d-learn mailing list