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

Change drag preview property cause crash when exported in release mode only #46335

Closed
yikescloud opened this issue Feb 23, 2021 · 4 comments · Fixed by #46360
Closed

Change drag preview property cause crash when exported in release mode only #46335

yikescloud opened this issue Feb 23, 2021 · 4 comments · Fixed by #46360

Comments

@yikescloud
Copy link

yikescloud commented Feb 23, 2021

Godot version:
3.2.3 official(steam version)

OS/device including version:
windows 10 professional

Issue description:
Change drag preview property will cause crash on build version( no crash on debug export or in game engine)

Steps to reproduce:

  1. Add a itemlist and give it a preview
  2. Change preview text in gui_input(check whether the preview is exist)
  3. Run in godot or export debug version, run well
  4. Export non-debug version. crash when drag

Use call_deferred cannot fix the crash
Maybe some relation with#36724

Minimal reproduction project:
PreviewCrash.zip

@yikescloud
Copy link
Author

yikescloud commented Feb 23, 2021

Set preview to null when drop data can fix the crash

func drop_data(position, data):
	preview = null
	return

Maybe drop data break the gui_input process and free the preview node just before "if preview != null"

@Calinou Calinou changed the title Change drag preview property cause crash on build version Change drag preview property cause crash when exported in release mode only Feb 23, 2021
@nmrkr
Copy link
Contributor

nmrkr commented Feb 23, 2021

The engine takes ownership of whatever control you throw at set_drag_preview. Once the drag is completed, the control is deleted by the engine itself. Your var preview then becomes invalid. So it makes sense that clearing the var mitigates the crash.

@KoBeWi
Copy link
Member

KoBeWi commented Feb 23, 2021

Upgrade to 3.2.4 and change your check to if preview or if preview != null, you will get error in debug build. To avoid it properly you should do if is_instance_valid(preview).

Here's a similar recent issue: #46359
Tagging as documentation, #46360 will resolve this.

@yikescloud
Copy link
Author

Upgrade to 3.2.4 and change your check to if preview or if preview != null, you will get error in debug build. To avoid it properly you should do if is_instance_valid(preview).

Here's a similar recent issue: #46359
Tagging as documentation, #46360 will resolve this.

That will fix the crash, thanks!

@akien-mga akien-mga added this to the 4.0 milestone Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants