Skip to content

UI: Delete selection dialogs when parent is deleted - #8725

Closed
cg2121 wants to merge 1 commit into
obsproject:masterfrom
cg2121:fix-browse-crash
Closed

UI: Delete selection dialogs when parent is deleted#8725
cg2121 wants to merge 1 commit into
obsproject:masterfrom
cg2121:fix-browse-crash

Conversation

@cg2121

@cg2121 cg2121 commented Apr 12, 2023

Copy link
Copy Markdown
Contributor

Description

In the source context bar, when an user opens a selection dialog
(font, color or file), and they switch scenes (causing the source
toolbar to be deleted), OBS would crash, as the dialog is no longer
valid. This is fixed by deleting the dialog when the toolbar is
deleted.

Motivation and Context

Fixes #7824

How Has This Been Tested?

Made sure the selection dialogs were deleted when switching scenes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@cg2121
cg2121 force-pushed the fix-browse-crash branch 2 times, most recently from f1d3a69 to ef4890a Compare April 12, 2023 22:26
@cg2121 cg2121 added the kind/bug Categorizes issue or PR as related to a bug. label Apr 12, 2023
@cg2121
cg2121 force-pushed the fix-browse-crash branch from ef4890a to 4d7d102 Compare April 13, 2023 00:28
@cg2121 cg2121 added this to the OBS Studio 29.1 milestone Apr 14, 2023
@jp9000 jp9000 changed the title UI: Fix crash when switching scenes UI: Disable hotkeys while in file open or color select dialog Apr 15, 2023
@jp9000 jp9000 changed the title UI: Disable hotkeys while in file open or color select dialog UI: Disable hotkeys while in source toolbar file open or color select dialog Apr 15, 2023
@WizardCM

Copy link
Copy Markdown
Member

Unfortunately this only fixes the crash with hotkeys. It'll still occur when switching scenes via WebSocket or third party plugins/scripts. The better way to fix this would be by properly using the relevant dialog constructors rather than the helper functions, and automatically closing the dialog during the destruction of the toolbar.

In the source context bar, when an user opens a selection dialog
(font, color or file), and they switch scenes (causing the source
toolbar to be deleted), OBS would crash, as the dialog is no longer
valid. This is fixed by deleting the dialog when the toolbar is
deleted.
@cg2121
cg2121 force-pushed the fix-browse-crash branch from 4d7d102 to 0903ec6 Compare April 16, 2023 02:48
@cg2121 cg2121 changed the title UI: Disable hotkeys while in source toolbar file open or color select dialog UI: Delete selection dialogs when parent is deleted Apr 16, 2023
@cg2121

cg2121 commented Apr 16, 2023

Copy link
Copy Markdown
Contributor Author

Updated it to delete the selection dialogs, when scenes are switched.

@CodeYan01

CodeYan01 commented Jun 14, 2023

Copy link
Copy Markdown
Contributor

While this is about the toolbar, i've seen this happen with my media playlist plugin that creates an editable list property. i have code that will use obs_source_update_properties when the video has ended (as i want the property to show the file name of the current file in the editable list). if one were to add file/folder/url and have the dialog open while the video ends (thereby calling that code that calls obs_source_update_properties), obs crashes with a similar QT crash log. It also happens if the user is dragging an item in the list while the obs_source_update_properties is called. Of course, this is due to the properties being recreated, and what I did is likely unsupported (and I have since removed the obs_source_update_properties call when the video ends), but I wanted to mention it anyway.

@PatTheMav

Copy link
Copy Markdown
Member

Could it be that this is a Windows-specific issue? Because in my tests the file browser, font picker, and colour picker are all modal dialogs, so I cannot even change the scene.

Or did we fix this in the meantime - @gxalpha does this ring a bell?

@cg2121

cg2121 commented Dec 8, 2023

Copy link
Copy Markdown
Contributor Author

It happens when you switch scenes with hotkeys.

@PatTheMav

Copy link
Copy Markdown
Member

It happens when you switch scenes with hotkeys.

Thanks, got it to crash. It also blocked keyboard input in all other applications, which is even worse..

I do wonder if the easier fix would be to ignore hotkeys affecting the main window when a modal window is open. Allowing hotkeys to affect the underlying (blocked) Window seems wrong and runs counter to the idea of a modal dialog.

@cg2121 cg2121 mentioned this pull request Dec 10, 2023
6 tasks
@cg2121

cg2121 commented Dec 10, 2023

Copy link
Copy Markdown
Contributor Author

Closing in favor of #9981

@cg2121 cg2121 closed this Dec 10, 2023
@cg2121
cg2121 deleted the fix-browse-crash branch December 10, 2023 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OBS Crashes when switching scenes by hotkey and an Image source file dialog box is open

5 participants