void* pointers get corrupted: D bug or misunderstanding?

Federico Santamorena federico at santamorena.me
Mon Jul 29 10:43:35 UTC 2019


On Monday, 29 July 2019 at 08:35:20 UTC, Jonathan Marler wrote:
>
> Can you print the raw pointer value of context/userObj at 
> different points to see when the corruption occurs?
>
> Print "context" here: 
> https://github.com/yatima1460/Drill/blob/576b4b691ea5357e5271115433eb11d4c0beeae7/Source/Frontend/GTK/Main.d#L585
>
> Print "context" here:
> https://github.com/yatima1460/Drill/blob/576b4b691ea5357e5271115433eb11d4c0beeae7/Source/Frontend/GTK/Main.d#L384
>
> Print "userObject" here:
> https://github.com/yatima1460/Drill/blob/576b4b691ea5357e5271115433eb11d4c0beeae7/Source/Backend/Context.d#L187
>
> Print "userObject" here:
> https://github.com/yatima1460/Drill/blob/576b4b691ea5357e5271115433eb11d4c0beeae7/Source/Backend/Context.d#L195
>
> Then print "userObject" here:
> https://github.com/yatima1460/Drill/blob/576b4b691ea5357e5271115433eb11d4c0beeae7/Source/Frontend/GTK/Main.d#L304
>
> It looks like you're using printf so "%p" should work to print 
> the pointer.

GC disabled:

activate context:0x7ffca2d0c4f8
gtk_search_changed context:0x7ffca2d0c4f8
startCrawling userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
startCrawling foreach loop userObject:0x7ffca2d0c4f8
resultFound result:0x7fc843559c60 userObject:0x7fc8435414d0
(drill-search-gtk:12395): GLib-CRITICAL **: 12:40:07.937: 
g_async_queue_push: assertion 'queue' failed

GC enabled:

activate context:0x7ffe9369c298
gtk_search_changed context:0x7ffe9369c298
startCrawling userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
startCrawling foreach loop userObject:0x7ffe9369c298
resultFound result:0x7f4f2625bb00 userObject:0x7f4f2628d440
(drill-search-gtk:12223): GLib-CRITICAL **: 12:38:54.729: 
g_async_queue_push: assertion 'queue' failed

As you can see the queue pointer inside the context is invalid 
because the context itself is now invalid and GLib notifies it
GC on or off does not make any difference, and the corruption 
happens at resultFound
I also want to add that I replaced the struct FileInfo with a 
pointer and it still happens


https://github.com/yatima1460/Drill/commit/5653c831b03d657a0c8073d5b011934f02ac8b65



More information about the Digitalmars-d mailing list