Page MenuHome

Crash after any alembic import undo in an empty scene
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Linux-3.10.0-1062.9.1.el7.x86_64-x86_64-with-centos-7.7.1908-Core 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.44

Blender Version
Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 14:38, hash: rB211b6c29f771

Short description of error
The bug appears only on an empty scene after importing an alembic and undo.Crash after any alembic import, then immediately undo without any other steps

Exact steps for others to reproduce the error

  • Open Blender and delete all the objects if there are any
  • import .abc
  • no other steps
  • undo --> crash

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.EditedJun 11 2020, 12:37 PM
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

Can confirm.

Philipp Oeser (lichtwerk) renamed this task from Crash after any alembic import undo in an empty scene to Crash after any alembic import undo.Jun 11 2020, 12:43 PM
Philipp Oeser (lichtwerk) updated the task description. (Show Details)
Sybren A. Stüvel (sybren) claimed this task.

@Philipp Oeser (lichtwerk) reproduced this bug, but I can't reproduce it with the latest official release (2.83) or with the latest daily build (2.90 rB2797a63a6606). so it appears the bug has been fixed already.

Please try the latest daily build: https://builder.blender.org/download/

If the problem persists, please let us know so we can re-open the report. Don't forget to mention the specific version you tested again.

Philipp Oeser (lichtwerk) reopened this task as Confirmed.Jun 15 2020, 1:34 PM

I can still repro with todays buildbot and 2.83 release.

God only knows why I was able to reproduce this in a non-empty scene (and why I have updated the report description and title), sorry for the confusion!
This only happens in an empty scene (will update the report again)

Philipp Oeser (lichtwerk) renamed this task from Crash after any alembic import undo to Crash after any alembic import undo in an empty scene.Jun 15 2020, 1:36 PM
Philipp Oeser (lichtwerk) updated the task description. (Show Details)

I still can't reproduce it, even on an empty scene.

@Philipp Oeser (lichtwerk) what platform are you testing on? I have Kubuntu Linux 19.10 (kernel 5.3.0), NVidia GTX 1080 (driver version 450.36.06).

Also, which version of Blender did still work properly?

Just tested 2.90 from the buildbot and it still crashes on Mint and CenOS

Bastien Montagne (mont29) triaged this task as High priority.

This is related to Undo I think. Alembic and Collada import operators are not flagged for undo (!!!), will fix this now, but this is not enough to fix the crash.

Well in fact issue is with alembic importer, which starts a background job for actual import, so undo step stored by the operator management system is done before data is actually changed, and importer had to do its own undo push when it is done.

This quick patch solves it, but not sure it's the best way to handle it (it add extra useless undo step e.g.), will let @Sybren A. Stüvel (sybren) handle it from there.

1diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc
2index 0b4b184359b..a406b63df06 100644
3--- a/source/blender/io/alembic/intern/alembic_capi.cc
4+++ b/source/blender/io/alembic/intern/alembic_capi.cc
5@@ -51,6 +51,8 @@
6 #include "DEG_depsgraph.h"
7 #include "DEG_depsgraph_build.h"
8
9+#include "ED_undo.h"
10+
11 /* SpaceType struct has a member called 'new' which obviously conflicts with C++
12 * so temporarily redefining the new keyword to make it compile. */
13 #define new extern_new
14@@ -429,6 +431,7 @@ enum {
15 };
16
17 struct ImportJobData {
18+ bContext *C;
19 Main *bmain;
20 Scene *scene;
21 ViewLayer *view_layer;
22@@ -447,6 +450,7 @@ struct ImportJobData {
23 char error_code;
24 bool was_cancelled;
25 bool import_ok;
26+ bool is_background_job;
27 };
28
29 static void import_startjob(void *user_data, short *stop, short *do_update, float *progress)
30@@ -630,6 +634,12 @@ static void import_endjob(void *user_data)
31
32 DEG_id_tag_update(&data->scene->id, ID_RECALC_BASE_FLAGS);
33 DEG_relations_tag_update(data->bmain);
34+
35+ if (data->is_background_job) {
36+ /* We already returned from the import operator, so we need to store our own extra undo step.
37+ */
38+ ED_undo_push(data->C, "Alembic Import Finished");
39+ }
40 }
41
42 for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) {
43@@ -675,6 +685,7 @@ bool ABC_import(bContext *C,
44 {
45 /* Using new here since MEM_* functions do not call constructor to properly initialize data. */
46 ImportJobData *job = new ImportJobData();
47+ job->C = C;
48 job->bmain = CTX_data_main(C);
49 job->scene = CTX_data_scene(C);
50 job->view_layer = CTX_data_view_layer(C);
51@@ -691,6 +702,7 @@ bool ABC_import(bContext *C,
52 job->error_code = ABC_NO_ERROR;
53 job->was_cancelled = false;
54 job->archive = NULL;
55+ job->is_background_job = as_background_job;
56
57 G.is_break = false;
58