1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 15:29:42 +01:00

Don't crash when moving the mouse after hitting Cancel in the Share widget

This commit is contained in:
Leo Franchi 2012-06-12 17:28:58 +02:00
parent 3456f5d038
commit 833a9f59d3
2 changed files with 14 additions and 1 deletions

View File

@ -61,7 +61,7 @@ SocialWidget::SocialWidget( QWidget* parent )
m_parent->installEventFilter( this );
connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( accept() ) );
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( deleteLater() ) );
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( close() ) );
connect( ui->textEdit, SIGNAL( textChanged() ), SLOT( onChanged() ) );
connect( ui->facebookButton, SIGNAL( clicked( bool ) ), SLOT( onChanged() ) );
connect( ui->twitterButton, SIGNAL( clicked( bool ) ), SLOT( onChanged() ) );
@ -89,6 +89,7 @@ SocialWidget::setOpacity( qreal opacity )
if ( m_opacity == 0.00 && !isHidden() )
{
QWidget::hide();
emit hidden();
}
else if ( m_opacity > 0.00 && isHidden() )
{
@ -254,6 +255,14 @@ SocialWidget::accept()
}
void
SocialWidget::close()
{
hide();
connect( this, SIGNAL( hidden() ), this, SLOT( deleteLater() ) );
}
unsigned int
SocialWidget::charsAvailable() const
{

View File

@ -50,6 +50,9 @@ public:
bool shown() const;
signals:
void hidden();
public slots:
void show( int timeoutSecs = 0 );
void hide();
@ -65,6 +68,7 @@ private slots:
void onShortLinkReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj );
void onGeometryUpdate();
void close();
private:
unsigned int charsAvailable() const;