Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on closing iOS chat dialog #3413

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ann0see
Copy link
Member

@ann0see ann0see commented Oct 14, 2024

Short description of changes

Using close() instead of hide() would crash the app as soon as one taps at the screen after closing the chat dialog. Due to a null pointer dereference (?).
I do not understand why the app crashes. Probably it's a qt bug.

ASSERT failure in QCoreApplication::sendEvent: "Unexpected null receiver", file /Users/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 1587

Can't show file for stack frame : <DBGLLDBStackFrame: 0x7fcf61f51120> - stackNumber:3 - name:qAbort. The file path does not exist on the file system: /Users/qt/work/qt/qtbase/src/corelib/global/qglobal.cpp

https://qtcentre.org/threads/5572-QCoreApplication-postEvent-Unexpected-null-receiver (?)

CHANGELOG: iOS: Fix crash on Qt6 after closing the chat window.

Context: Fixes an issue?

Related to: #3406
Does this change need documentation? What needs to be documented and how?

Status of this Pull Request

Ready for review.

What is missing until this pull request can be merged?

Discussion. This is a hot fix...

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@ann0see ann0see added this to the Release 3.12.0 milestone Oct 14, 2024
@ann0see ann0see added the bug Something isn't working label Oct 14, 2024
@ann0see ann0see self-assigned this Oct 14, 2024
@@ -62,7 +62,7 @@ CChatDlg::CChatDlg ( QWidget* parent ) : CBaseDlg ( parent, Qt::Window ) // use
pMenu->addMenu ( pEditMenu );
#if defined( Q_OS_IOS )
QAction* action = pMenu->addAction ( tr ( "&Close" ) );
connect ( action, SIGNAL ( triggered() ), this, SLOT ( close() ) );
Copy link
Collaborator

@pljones pljones Oct 18, 2024

Choose a reason for hiding this comment

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

Whilst we're doing this, I would like the two lines changed to match the addActions before and after that both include the action handler.

I'll also ask why this should be hide() for iOS and close() for Android -- I'm going to hazard a guess it should be the same request to Qt on both platforms and that Qt should do the right thing.

I'd even go as far as to suggest that having &Close on the menu bar in the app, regardless of platform, wouldn't necessarily be a bad thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I understand hide() is close() minus deleting the dialog.
Somehow on iOS under Qt6 the dialog already gets deleted and close() may attempt to do it twice.

Potentially it's the same on android with Qt6 - but we don't know for sure yet.

Yes, we could add the close menu entry on all OS - on desktop it seems redundant however.

Copy link
Collaborator

@pljones pljones Oct 20, 2024

Choose a reason for hiding this comment

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

I'd argue that UI consistency across platforms isn't "redundant" but makes for a more consistent user experience -- with the benefit of reducing code complexity and maintenance overhead.

Copy link
Member Author

Choose a reason for hiding this comment

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

The close entry on desktop OS is redundant since there's a close button in the window manager.

It does not make sense to hide the close button in a menu on mobile OS (at least iOS, where there's no back button).

Using close() would crash due to a null pointer dereference
@ann0see
Copy link
Member Author

ann0see commented Oct 19, 2024

@softins I've pushed a new build with this + the icon PR on TestFlight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

2 participants