Skip to content

SG-17742 Attempt to fix the crash issue with Houdini#83

Draft
carlos-villavicencio-adsk wants to merge 3 commits into
masterfrom
ticket/SG-17742_crash_on_close_houdini
Draft

SG-17742 Attempt to fix the crash issue with Houdini#83
carlos-villavicencio-adsk wants to merge 3 commits into
masterfrom
ticket/SG-17742_crash_on_close_houdini

Conversation

@carlos-villavicencio-adsk

@carlos-villavicencio-adsk carlos-villavicencio-adsk commented Jan 16, 2024

Copy link
Copy Markdown
Contributor

When opening the tk-multi-shotgunpanel in Houdini, the Houdini app crashes on exit. This has been reported by the community.

This PR attempts to fix this by properly destroying Qt objects on close. This solution was inspired on tk-multi-workfiles2.

This PR requires shotgunsoftware/tk-framework-shotgunutils#149

Comment thread python/app/utils.py Outdated
Comment thread python/app/utils.py
Comment thread python/app/widget_all_fields.py

@NorberMV NorberMV left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a Houdini crash on exit by replacing Qt’s deleteLater() with a destroy() method to properly clean up objects and by adding debugging utilities to monitor the lifecycle of Qt objects.

  • Replace deleteLater() with destroy() on widgets to address memory management issues.
  • Introduce utility functions to track QObject lifetimes with debug logging.
  • Adjust task manager initialization and widget destruction ordering to ensure proper cleanup.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
python/app/widget_all_fields.py Replace deleteLater() with destroy() for widget cleanup.
python/app/utils.py Add functions for monitoring QObject lifetimes to aid in debugging.
python/app/dialog.py Reorder background task manager startup and widget destruction; integrate QObject monitoring.
Comments suppressed due to low confidence (2)

python/app/utils.py:222

  • Consider potential thread-safety issues when modifying the global _g_monitored_qobjects dictionary, especially if accessed from multiple threads.
_g_monitored_qobjects = {}

python/app/dialog.py:282

  • Ensure that calling destroy() on UI components in closeEvent aligns with Qt's widget cleanup mechanism and does not lead to premature destruction.
self._overlay.destroy()

Comment thread python/app/dialog.py
entity_data["model"] = ModelClass(
entity_data["entity_type"], entity_data["view"], self._task_manager
)
monitor_qobject_lifetime(entity_data["model"])

Copilot AI May 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider providing a descriptive name for the monitored model to improve clarity in debug logs.

Suggested change
monitor_qobject_lifetime(entity_data["model"])
monitor_qobject_lifetime(entity_data["model"], name=str(ModelClass.__name__))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants