Skip to content

Backport PR #19671 on branch v3.4.x (Fix crash in early window raise in gtk3.) #19678

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,14 @@ def show(self):
self.window.show()
self.canvas.draw()
if mpl.rcParams['figure.raise_window']:
self.window.present()
if self.window.get_window():
self.window.present()
else:
# If this is called by a callback early during init,
# self.window (a GtkWindow) may not have an associated
# low-level GdkWindow (self.window.get_window()) yet, and
# present() would crash.
_api.warn_external("Cannot raise window yet to be setup")

def full_screen_toggle(self):
self._full_screen_flag = not self._full_screen_flag
Expand Down