Maniphest T44688

To set stereo 3d mode to Time Sequential may crash Blender
Closed, Resolved

Assigned To
Dalai Felinto (dfelinto)
Authored By
Dalai Felinto (dfelinto)
May 13 2015, 12:11 AM
Tags
  • BF Blender
  • BF Blender: Next
Subscribers
Campbell Barton (campbellbarton)
Dalai Felinto (dfelinto)
Sergey Sharybin (sergey)
Thomas Dinges (dingto)

Description

System Information
OSX 10.9.5 but I also suspect Linux have this issue.

Short description of error
When setting 3D to Time Sequential (aka Quadbuffer) Blender duplicates the window (see wm_stereo3d_set_exec), when 'time sequential is not supported, the menu lingers open, and leads to a crash after I try to press OK, or simply click around the UI.

Also, if I try to change the stereo mode in the python console it works fine:
bpy.ops.wm.set_stereo_3d(display_mode='TIMESEQUENTIAL')

Exact steps for others to reproduce the error

  • Turn on Views (in the Render Layer panel)
  • Set Stereo 3D mode to Time Sequential (in the Info Header > Window > Set Stereo 3D, 'Time Sequential')

Now quit the menu (esc), or just click anywhere in the UI and boom !

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x000000010002df45 in wm_operator_ui_popup_cancel (C=0x107f11ea8, userData=0x108fd6ea8) at //blender/windowmanager/intern/wm_operators.c:1657
1657			if (op->type->cancel) {

This may be related to the 'broken pop UI' I get when Quadbuffer is not supported:


(look at the exclamation mark on the left)

Revisions and Commits

rB Blender

Related Objects

Mentioned In
T66530: set_stereo_3d exists Blender
rBe1b8ed8dd4e8: Multiview: fix Time Sequential crash when screen is fullscreen T44688
rBb54e95a5c8dc: Alternative fix copying windows from popup dialogs
rB95b9d6d9c206: Fix operator exec /w popups that close the window
Mentioned Here
rB962f764d5884: WM: refactor window code for stereo3d
rBb54e95a5c8dc: Alternative fix copying windows from popup dialogs
rB95b9d6d9c206: Fix operator exec /w popups that close the window

Event Timeline

Dalai Felinto (dfelinto) created this task.May 13 2015, 12:11 AM
Dalai Felinto (dfelinto) raised the priority of this task from to 90.
Dalai Felinto (dfelinto) updated the task description.
Dalai Felinto (dfelinto) added a project: BF Blender.
Dalai Felinto (dfelinto) edited a custom field.
Dalai Felinto (dfelinto) added a subscriber: Dalai Felinto (dfelinto).
perfection cat (sindra1961) added a subscriber: perfection cat (sindra1961).May 13 2015, 5:09 AM

It crashes when I perform something in the pop-up window after a warning mark appeared.
However, it does not crash when I click another place of 3dview in defiance of it.
The error of not supporting Quad-buffer in a log file is recorded.

Dalai Felinto (dfelinto) added a subscriber: Campbell Barton (campbellbarton).May 13 2015, 7:26 AM

@Campbell Barton (campbellbarton) any chance you could look at that? This seems related to context/operator getting buggy after windows duplication

Sergey Sharybin (sergey) lowered the priority of this task from 90 to Normal.May 13 2015, 11:34 AM
Sergey Sharybin (sergey) added a subscriber: Sergey Sharybin (sergey).
Dalai Felinto (dfelinto) added a comment.May 20 2015, 6:39 AM

For the records, in some systems, there is a crash that happens prior to the real issue. So for general testing the patch below helps to reproduce the issue in some linuxes too.

diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 717583f..cffcbd8 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -463,8 +463,23 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
        }
 
        s3dd = op->customdata;
-       *win->stereo3d_format = s3dd->stereo3d_format;
+       //*win->stereo3d_format = s3dd->stereo3d_format;
 
+#if 1
+       if (s3dd->stereo3d_format.display_mode == S3D_DISPLAY_PAGEFLIP) {
+               /* pageflip requires a new window to be created with the proper OS flags */
+               if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) {
+                       wmWindow *win_new = wm->windows.last;
+                       wm_window_close(C, wm, win_new);
+                       BKE_report(op->reports, RPT_ERROR, "Quad-buffer not supported by the system");
+               }
+               else {
+                       BKE_report(op->reports, RPT_ERROR,
+                                  "Failed to create a window compatible with the time sequential display method");
+                       win->stereo3d_format->display_mode = prev_display_mode;
+               }
+       }
+#else
        if (prev_display_mode == S3D_DISPLAY_PAGEFLIP &&
            prev_display_mode != win->stereo3d_format->display_mode)
        {
@@ -497,6 +512,7 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
                        win->stereo3d_format->display_mode = prev_display_mode;
                }
        }
+#endif
 
        if (wm_stereo3d_is_fullscreen_required(s3dd->stereo3d_format.display_mode)) {
                if (!is_fullscreen) {
Sergey Sharybin (sergey) added a project: BF Blender: Next.May 25 2015, 4:00 PM
Sergey Sharybin (sergey) assigned this task to Campbell Barton (campbellbarton).May 25 2015, 8:28 PM

@Campbell Barton (campbellbarton), afraid you know this are better than me. Mind having a look and give some help to Dalai?

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved by committing rBd9b676852102: Fix T44688: Stereo3D time-sequential crashes.May 28 2015, 10:47 AM
Campbell Barton (campbellbarton) added a commit: rBd9b676852102: Fix T44688: Stereo3D time-sequential crashes.
Dalai Felinto (dfelinto) added a comment.May 28 2015, 1:51 PM

@Campbell Barton (campbellbarton) after your commit I get the following crash:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00000001012f8537 in BLI_remlink (listbase=0x10b300408, vlink=0x10b65a768) at /Users/dfelinto/blender/git/blender/source/blender/blenlib/intern/listbase.c:111
111		if (link->next) link->next->prev = link->prev;
(gdb) bt
#0  0x00000001012f8537 in BLI_remlink (listbase=0x10b300408, vlink=0x10b65a768) at /Users/dfelinto/blender/git/blender/source/blender/blenlib/intern/listbase.c:111
#1  0x000000010001773b in wm_event_do_handlers (C=0x107f11d68) at /Users/dfelinto/blender/git/blender/source/blender/windowmanager/intern/wm_event_system.c:2468
#2  0x000000010000bc1e in WM_main (C=0x107f11d68) at /Users/dfelinto/blender/git/blender/source/blender/windowmanager/intern/wm.c:487
#3  0x0000000100007391 in main (argc=1, argv=0x7fff5fbff740) at /Users/dfelinto/blender/git/blender/source/creator/creator.c:1882
Current language:  auto; currently minimal

(OSX here) is it working in your computer? Do you see the error message popup?

Campbell Barton (campbellbarton) mentioned this in rB95b9d6d9c206: Fix operator exec /w popups that close the window.Jun 2 2015, 11:03 AM
Campbell Barton (campbellbarton) added a comment.Jun 2 2015, 11:03 AM

@Dalai Felinto (dfelinto), could you try with rB95b9d6d9c2063426a0051363a7de0214b8e89cc1 or later?

(I had to trick Blender into thinking the OpenGL state was OK to test the patch, think its fixed now)

Dalai Felinto (dfelinto) added a comment.Jun 2 2015, 4:28 PM

@Campbell Barton (campbellbarton) it's almost there. When the window is NOT in fullscreen it no longer crashes. If I set fullscreen first (Alt+F11) I then get the same segfault as above (listbase.c:111)

Campbell Barton (campbellbarton) added a comment.EditedJun 3 2015, 4:11 AM

@Dalai Felinto (dfelinto), As you did before, could you make a patch which will crash? without the system having to support 3d hardware I don't have? :)

Re-opening bug so we dont forget about it for release.

Campbell Barton (campbellbarton) changed the task status from Resolved to Unknown Status.Jun 3 2015, 4:18 AM
perfection cat (sindra1961) removed a subscriber: perfection cat (sindra1961).Jun 3 2015, 4:22 AM
Dalai Felinto (dfelinto) added a subscriber: Thomas Dinges (dingto).Jun 3 2015, 7:22 PM

I can't reproduce the issue (Alt+F11) on linux, @Thomas Dinges (dingto) can you try that on windows to see if it's OSX specific?

How to test:

  1. Alt+F11
  2. Turn on Views
  3. Set Stereo 3D mode to Time Sequential
Campbell Barton (campbellbarton) mentioned this in rBb54e95a5c8dc: Alternative fix copying windows from popup dialogs.Jun 8 2015, 8:07 AM
Campbell Barton (campbellbarton) added a comment.Jun 8 2015, 8:21 AM

Managed to get a crash with the popup, should be really fixed this time. rBb54e95a5c8dcb7eae1059af107a7cdfa028d7e2e

But theres still a crash:

  • Alt+F10
  • Alt+F11
  • Set Stereo 3D -> Time Sequential
#0 0x43c2543 in BLI_strnlen /src/blender/source/blender/blenlib/intern/string.c:726
#1 0x43bee6b in BLI_strncpy /src/blender/source/blender/blenlib/intern/string.c:116
#2 0xa44055 in wm_window_copy /src/blender/source/blender/windowmanager/intern/wm_window.c:258
#3 0xa4798d in wm_window_duplicate_exec /src/blender/source/blender/windowmanager/intern/wm_window.c:622
#4 0xa52109 in wm_stereo3d_set_exec /src/blender/source/blender/windowmanager/intern/wm_stereo.c:484
#5 0x9d598b in wm_operator_exec /src/blender/source/blender/windowmanager/intern/wm_event_system.c:771
#6 0x9d5f79 in WM_operator_call_ex /src/blender/source/blender/windowmanager/intern/wm_event_system.c:823
#7 0xa1cfa1 in dialog_exec_cb /src/blender/source/blender/windowmanager/intern/wm_operators.c:1563
#8 0x14f7336 in ui_apply_but_funcs_after /src/blender/source/blender/editors/interface/interface_handlers.c:742
#9 0x1560a17 in ui_popup_handler /src/blender/source/blender/editors/interface/interface_handlers.c:9810
#10 0x9d2998 in wm_handler_ui_call /src/blender/source/blender/windowmanager/intern/wm_event_system.c:457
#11 0x9e07a8 in wm_handlers_do_intern /src/blender/source/blender/windowmanager/intern/wm_event_system.c:2008
#12 0x9e1112 in wm_handlers_do /src/blender/source/blender/windowmanager/intern/wm_event_system.c:2092
#13 0x9e36d4 in wm_event_do_handlers /src/blender/source/blender/windowmanager/intern/wm_event_system.c:2375
#14 0x9b5a9b in WM_main /src/blender/source/blender/windowmanager/intern/wm.c:487
#15 0x9b2470 in main /src/blender/source/creator/creator.c:1887
#16 0x7f7778edc78f in __libc_start_main (/usr/lib/libc.so.6+0x2078f)
#17 0x9ab4a8 in _start (/src/cmake_debug/bin/blender+0x9ab4a8)
Dalai Felinto (dfelinto) added a comment.Jun 8 2015, 3:18 PM

@Campbell Barton (campbellbarton) you don't even need Alt+F11 for this crash in string.c, "Alt+F10, Set Stereo 3D > Time Sequencial" is enough. I'll look at that. I still get the Alt + F11 crash, but it's probably OSX only.

Campbell Barton (campbellbarton) added a comment.Jun 8 2015, 5:34 PM

@Dalai Felinto (dfelinto),

Looks like making ED_screen_duplicate support non-normal screens will fix.
Just need to make sure the screen state remains valid at all times. (when using a temp screen for eg).

Note that testing different fixes here was getting problematic. Committed rB962f764d58847614d083dc382285d997652d6992 to avoid calling operator exec to duplicate screen (so its easier to add args if we want).

Campbell Barton (campbellbarton) reassigned this task from Campbell Barton (campbellbarton) to Dalai Felinto (dfelinto).Jun 8 2015, 5:45 PM
Dalai Felinto (dfelinto) mentioned this in rBe1b8ed8dd4e8: Multiview: fix Time Sequential crash when screen is fullscreen T44688.Jun 8 2015, 11:52 PM
Campbell Barton (campbellbarton) added a comment.Jun 9 2015, 7:49 AM

@Dalai Felinto (dfelinto), is this fixed now?

If not, would be good to note what fails exactly, AFAICS there were 2 bugs which are resolved.

Dalai Felinto (dfelinto) added a comment.Jun 9 2015, 9:31 AM

@Campbell Barton (campbellbarton) apart from the fullwindow (Alt + F11) issue in OSX, I believe the bug is fixed. I'm yet to confirm if we didn't break quadbuffer support for computers that can handle it, so I will wait to close this until later this week.

Campbell Barton (campbellbarton) added a comment.EditedJun 9 2015, 11:36 AM

@Dalai Felinto (dfelinto). maybe am being a bit picky - but the state of this report is confusing now.
If I had OSX and wanted to fix I wouldn't even know where to start.
Maybe this report could be closed,. Then open new report with remaining issue?

Its just this is potentially holding up release, so leaving it in some unknown state means its hard keep track of what needs doing.

Dalai Felinto (dfelinto) changed the task status from Unknown Status to Resolved.Jun 10 2015, 9:09 PM

OK, I just tested master in a quadbuffer compatible station and things are working from either fullscreen (Alt+F11) or windowed modes.

I'm closing this now and I'll report the fullscreen + OSX issue separately later.

Out of curiosity, when in fullscreen (Alt + F11) in Linux, after toggling Pageflip mode, the new window is not fullscreen. I think this is a minor drawback, so nothing to worry about.

Campbell Barton (campbellbarton) mentioned this in T66530: set_stereo_3d exists Blender.Jul 7 2019, 2:55 PM