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

PySide segfaults immediately on Linux #1404

Merged
merged 1 commit into from Oct 16, 2012
Merged

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Oct 16, 2012

PySide 1.1.0 crashes upon startup with this script

import matplotlib
matplotlib.use('Qt4Agg')
matplotlib.rcParams['backend.qt4']='PySide'
from matplotlib import pyplot
pyplot.plot()
pyplot.show()

It may or may not be related to #1323. (It happens whether or not that patch is applied).

@pelson
Copy link
Member

pelson commented Oct 16, 2012

@mdboom : I've put a release critical label on this (If you don't agree, feel free to take it off).

@dmcdougall
Copy link
Member

I can't test this; I don't have a linux machine.

@mdboom
Copy link
Member Author

mdboom commented Oct 16, 2012

@pelson: I agree it's release critical. Thanks for that.

…he cursor. Changing the cursor only on the window and not globally for the application seems to resolve the problem.
@mdboom
Copy link
Member Author

mdboom commented Oct 16, 2012

I think I have a fix here. When it tries to set the cursor shape globally for the application, it was crashing. Setting the cursor only for the window (and not the app as a whole) mysteriously resolves the issue. Would those on a Mac mind testing this (with both PyQt4 and PySide)?

@efiring
Copy link
Member

efiring commented Oct 16, 2012

With PySide 1.1.2 on OSX 10.8, your test script above works OK with or without this change.

Setting the cursor only for the window seems like the right thing to do in any case, doesn't it?

@mdboom
Copy link
Member Author

mdboom commented Oct 16, 2012

Yes -- I think this is more "expected" in any event.

@mdboom
Copy link
Member Author

mdboom commented Oct 16, 2012

Also, can you confirm it doesn't break if you use PyQt4 instead of PySide? They both use the same backend code (only with different imports).

@efiring
Copy link
Member

efiring commented Oct 16, 2012

On 2012/10/16 7:42 AM, Michael Droettboom wrote:

Also, can you confirm it doesn't break if you use PyQt4 instead of
PySide? They both use the same backend code (only with different imports).

PyQt4 also works.

@dmcdougall
Copy link
Member

PyQt4 also works.

Same here. OS X 10.7 python 2.7.3.

@mdboom
Copy link
Member Author

mdboom commented Oct 16, 2012

Great! I'm going to go ahead and merge, then.

mdboom added a commit that referenced this pull request Oct 16, 2012
PySide segfaults immediately on Linux
@mdboom mdboom merged commit d5109fa into matplotlib:v1.2.x Oct 16, 2012
@ChrisBeaumont
Copy link
Contributor

Hi @mdboom et al,

I noticed that this change broke code I was using that instantiated a FigureCanvas outside of pyplot. My problem is that canvas.manager is added to a FigureCanvas from FigureManagerBase (https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backend_bases.py#L2454). I hadn't created a FigureManager so, when matplotlib tries to change the cursor, python cant find canvas.manager and raises an attribute error:

--> 606         self.canvas.manager.window.setCursor(cursord[cursor])
AttributeError: 'MplCanvas' object has no attribute 'manager'

The documentation of FigureManagerBase says it is a "helper class for pyplot mode". Are FigureCanvases used outside of pyplot supposed to have a manager attribute? If so, should that be added to the FigureCanvas.init
somehow? If not, can this fix be modified to not depend on manager?

I can solve my own problem user-side, by creating a manager. I'm just posting here in case this behavior is unintended.

@ChrisBeaumont
Copy link
Contributor

One solution that I think does the same thing:

self.canvas.window().setCursor(cursord[cursor])

since Qt FigureCanvases are QWidgets

ChrisBeaumont pushed a commit to ChrisBeaumont/matplotlib that referenced this pull request Oct 29, 2012
pelson added a commit that referenced this pull request Oct 31, 2012
* 'v1.2.x' of github.com:matplotlib/matplotlib:
  Alternative to #1404. Sets the cursor without refering to a FigureManager
  Update version numbers
  Exception message improvement.
  Fixed transform=None behaviour on Artists.
  Add trove classifiers to setup.py
  Fix AttrituteError for .lower on tuple of strings
  Tables: Fix get_window_extent for table to allow table to be added to bbox_extra_artists. The get_window_extent is a method on the cells not the key of the cells.

Conflicts:
	lib/matplotlib/__init__.py
@mdboom mdboom deleted the pyside_crash branch March 3, 2015 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants