Commit 2185fa12 authored by Matěj Laitl's avatar Matěj Laitl
Browse files

ContextView: fix crash in addCollapseAnimation, dedicated to Mamarok

With some gdb fu, I was able to investigate that the root cause of the
bug was invalid static_cast<>, I wish static_casts were (almost) never
used in Amarok.

This crash-fix is a day-late present for Myriam Schweingruber's
birthday - cheers, Myriam! :-)

[this crash existed (in its current form) since at least 2011-07-14 as
reported by Marian Kyral. We thought we have fixed it already, but we
have in fact just reduced its probability by defaulting to a different
configuration wrt collapsing applets. My last patch touching this
7ff8068a was rather a blind guess and debugging patch than
a real fix.]

BUG: 258741
FIXED-IN: 2.6
CCMAIL: Myriam Schweingruber <myriam@kde.org>
DIGEST: Amarok crash-fix, please mention dedication ;-)
parent ecd51ac3
......@@ -8,6 +8,7 @@ VERSION 2.6
argument.
BUGFIXES:
* Finally fix crash on startup in addCollapseAnimation. (BR 258741)
* Don't hit "too many open files" when copying covers to iPod. (BR 301207)
* Don't crash if iPod's eject button is hit twice. (BR 301208)
* Don't crash even if the iPod is connected and quickly ejected. (BR 301166)
......
......@@ -288,7 +288,8 @@ Context::Applet::collapse( bool on )
finalHeight = maxHeight;
prepareGeometryChange();
ContextView *v = static_cast<ContextView*>( view() );
// warning: view() currently can return pointer to ToolbarView, not the ContextView
ContextView *v = ContextView::self(); // may return null
// Plasma::Applet::view() might return 0, if the widget is not yet constructed, etc.
// \sa https://bugs.kde.org/show_bug.cgi?id=258741. If view is not available
// yet, regardless of the animation setting the preferred size is set
......
......@@ -57,10 +57,10 @@ public:
ContextView( Plasma::Containment *containment, Plasma::Corona *corona, QWidget* parent = 0 );
~ContextView();
/**
* Singleton pattern accessor.
/**
* Singleton pattern accessor. May return 0 if the view was not yet constructed.
*/
static ContextView* self() { Q_ASSERT( s_self ); return s_self; }
static ContextView *self() { return s_self; }
/**
Returns the context scene that this view is attached to.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment