CTRL + C

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Racleborg
Posts: 621
Joined: Sat Apr 07, 2018 10:31 am
Location: UK

CTRL + C

Post by Racleborg »

Hi

As soon as I try to copy an object with a material using CTRL + C, Blender crashes. If I remove the material it's ok. This is always happening whether I use a new scene or an old one?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: CTRL + C

Post by B.Y.O.B. »

I can reproduce it.
This smells like a Blender bug related to Datablock ID Properties...
kintuX
Posts: 810
Joined: Wed Jan 10, 2018 2:37 am

Re: CTRL + C

Post by kintuX »

Reproduced when engine is set to LuxCore. Also crashes, if Cycles is used after.

Here's shot from console after the Material for Cube object is created.
Render Preview stopped and then "ctrl + c" pressed.
console_shot.jpg
PS.
Had never stumbled on this before as I don't copy objects. I prefer duplicating: Shift + D / Alt +D
Racleborg
Posts: 621
Joined: Sat Apr 07, 2018 10:31 am
Location: UK

Re: CTRL + C

Post by Racleborg »

I use ctrl C to get objects from one Blend file to another. I don't think this can be done with shift A. Is there another way?
Luxart
Posts: 49
Joined: Tue Feb 13, 2018 10:14 am

Re: CTRL + C

Post by Luxart »

You can simply Append (or) Link objects from one blend file to another
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: CTRL + C

Post by B.Y.O.B. »

I found the line where it crashes.
I suspect that id->lib is freed or uninitialized, but not set to NULL.

gdb session:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x0000000002b694d3 in blendfile_write_partial_cb (UNUSED_handle=0x0, UNUSED_bmain=0x7fffdebed608, vid=0x7fffd8b06a68) at /home/simon/programs/blender-git/blender/source/blender/blenkernel/intern/blendfile.c:569
569			if (id->lib && (id->lib->id.tag & LIB_TAG_DOIT) == 0)
(gdb) bt
#0  0x0000000002b694d3 in blendfile_write_partial_cb (UNUSED_handle=0x0, UNUSED_bmain=0x7fffdebed608, vid=0x7fffd8b06a68) at /home/simon/programs/blender-git/blender/source/blender/blenkernel/intern/blendfile.c:569
#1  0x0000000002a5b062 in expand_nodetree (fd=0x0, mainvar=0x7fffdebed608, ntree=0x7fffd8a27208) at /home/simon/programs/blender-git/blender/source/blender/blenloader/intern/readfile.c:9210
#2  0x0000000002a5d7c5 in BLO_expand_main (fdhandle=0x0, mainvar=0x7fffdebed608) at /home/simon/programs/blender-git/blender/source/blender/blenloader/intern/readfile.c:9908
#3  0x0000000002b695cb in BKE_blendfile_write_partial (bmain_src=0x7fffdebed608, filepath=0x7fffffffd840 "/tmp/copybuffer.blend", write_flags=16777216, reports=0x7fffc7701408)
    at /home/simon/programs/blender-git/blender/source/blender/blenkernel/intern/blendfile.c:596
#4  0x0000000002b6768d in BKE_copybuffer_save (bmain_src=0x7fffdebed608, filename=0x7fffffffd840 "/tmp/copybuffer.blend", reports=0x7fffc7701408)
    at /home/simon/programs/blender-git/blender/source/blender/blenkernel/intern/blender_copybuffer.c:81
#5  0x0000000001f96775 in view3d_copybuffer_exec (C=0x7fffe0087d38, op=0x7fffc7811e48) at /home/simon/programs/blender-git/blender/source/blender/editors/space_view3d/view3d_ops.c:95
#6  0x0000000001e4f71e in wm_operator_invoke (C=0x7fffe0087d38, ot=0x7fffd9db9488, event=0x7fffc7890288, properties=0x7fffcdac8f28, reports=0x0, poll_only=false)
    at /home/simon/programs/blender-git/blender/source/blender/windowmanager/intern/wm_event_system.c:1140
#7  0x0000000001e50e25 in wm_handler_operator_call (C=0x7fffe0087d38, handlers=0x7fffd89dea10, handler=0x7fffd8f64748, event=0x7fffc7890288, properties=0x7fffcdac8f28)
    at /home/simon/programs/blender-git/blender/source/blender/windowmanager/intern/wm_event_system.c:1782
#8  0x0000000001e5177c in wm_handlers_do_intern (C=0x7fffe0087d38, event=0x7fffc7890288, handlers=0x7fffd89dea10) at /home/simon/programs/blender-git/blender/source/blender/windowmanager/intern/wm_event_system.c:2062
#9  0x0000000001e51b3a in wm_handlers_do (C=0x7fffe0087d38, event=0x7fffc7890288, handlers=0x7fffd89dea10) at /home/simon/programs/blender-git/blender/source/blender/windowmanager/intern/wm_event_system.c:2173
#10 0x0000000001e5297c in wm_event_do_handlers (C=0x7fffe0087d38) at /home/simon/programs/blender-git/blender/source/blender/windowmanager/intern/wm_event_system.c:2508
#11 0x0000000001e462c7 in WM_main (C=0x7fffe0087d38) at /home/simon/programs/blender-git/blender/source/blender/windowmanager/intern/wm.c:504
#12 0x0000000001e41295 in main (argc=1, argv=0x7fffffffe0a8) at /home/simon/programs/blender-git/blender/source/creator/creator.c:527
(gdb) print id
$1 = (ID *) 0x7fffd8b06a68
(gdb) print vid
$2 = (void *) 0x7fffd8b06a68
(gdb) print id->tag
$3 = 32767
(gdb) print id->lib
$4 = (struct Library *) 0x6b636f5365646f4e
(gdb) print id->lib->id
Cannot access memory at address 0x6b636f5365646f4e
(gdb) print id->lib->id.tag
Cannot access memory at address 0x6b636f5365646fb2
The crashing code:

Code: Select all

if (id->lib && (id->lib->id.tag & LIB_TAG_DOIT) == 0)
    id->lib->id.tag |= LIB_TAG_DOIT;
So it is most certainly a Blender bug and not something on our side.
I will investigate further and open a ticket in the Blender bug tracker once I can give them a small example addon that reproduces the crash.

Unfortunately I would not bet that there will be a 2.79c, so if we're unlucky we will have to wait for 2.8 to have the fix in Blender.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: CTRL + C

Post by B.Y.O.B. »

I have narrowed it down further:
When I disable the code that sets the default value of new sockets, the problem no longer happens:
https://github.com/LuxCoreRender/BlendL ... t__.py#L54
It seems that doing this action inside the init() method of a node triggers the bug in Blender.

I hope I can find a workaround for this that is not too ugly.

edit:
Unfortunately it does not matter where the default_value is changed, it only matters if it is changed (even by the user through the UI).
So I fear that there is no workaround (other than forbid the user to touch any socket value :twisted: )
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: CTRL + C

Post by B.Y.O.B. »

Racleborg
Posts: 621
Joined: Sat Apr 07, 2018 10:31 am
Location: UK

Re: CTRL + C

Post by Racleborg »

I have a workaround that I'm quite happy to use, which is:

Firstly, copy the Material nodes from the first Blend file and paste them into the new Blend file (to any object).

Then delete the material from the first Blend file and just copy the object from the first Blend file to the new Blend file (when there is no material CTR+L works fine).

Then assign the copied nodes to the copied object. :D
Racleborg
Posts: 621
Joined: Sat Apr 07, 2018 10:31 am
Location: UK

Re: CTRL + C

Post by Racleborg »

Luxart.

Yes, LINK. Thanks
Is it possible to break the LINK, otherwise it acts like a standard CAD sub-assembly and if the original is modified then so is the copy?
Post Reply