Browse files

fixed #257 razor-panel segfaults - when there is no DBUS server runni…

…ng. The RzMountProvider's RazorMountDeviceList is not handled over pointer/casting anymore because QList is always implicitly shared.
  • Loading branch information...
1 parent 46d1527 commit 11bf65e739fa7e6ad56f02212f70f6b194c6b086 @pvanek pvanek committed Aug 29, 2012
View
7 libraries/razormount/razormount.cpp
@@ -98,12 +98,15 @@ void RazorMountManager::update()
}
-const RazorMountDeviceList *RazorMountManager::devices() const
+const RazorMountDeviceList RazorMountManager::devices() const
{
if (mProvider)
return mProvider->devices();
else
- return 0;
+ {
+ qDebug() << "RazorMountDeviceList RazorMountManager::devices() no valid provider in use";
+ return RazorMountDeviceList();
+ }
}
View
2 libraries/razormount/razormount.h
@@ -126,7 +126,7 @@ class RazorMountManager : public QObject
explicit RazorMountManager(QObject *parent = 0);
virtual ~RazorMountManager();
- const RazorMountDeviceList *devices() const;
+ const RazorMountDeviceList devices() const;
public slots:
void update();
View
2 libraries/razormount/rzmountproviders.h
@@ -44,7 +44,7 @@ class RzMountProvider : public QObject
explicit RzMountProvider(QObject *parent = 0);
virtual ~RzMountProvider() {}
- const RazorMountDeviceList *devices() const { return &mDevices; }
+ const RazorMountDeviceList devices() const { return mDevices; }
bool isValid() const { return mIsValid; }
virtual void update()=0;
View
8 razorqt-panel/plugin-mount/mountbutton.cpp
@@ -58,7 +58,7 @@ Popup::Popup(RazorMountManager *manager, QWidget* parent):
connect(mManager, SIGNAL(deviceAdded(RazorMountDevice*)),
this, SLOT(addItem(RazorMountDevice*)));
- foreach(RazorMountDevice *device, *(mManager->devices()))
+ foreach(RazorMountDevice *device, mManager->devices())
{
addItem(device);
}
@@ -215,7 +215,7 @@ void MountButton::onDeviceRemoved(RazorMountDevice *device)
break;
case DevActionMenu:
- if (mManager.devices()->isEmpty())
+ if (mManager.devices().isEmpty())
hidePopup();
break;
@@ -238,7 +238,7 @@ void MountButton::showHidePopup()
{
mPopupHideTimer.stop();
- if (mManager.devices()->isEmpty())
+ if (mManager.devices().isEmpty())
showMessage(tr("No devices Available."));
else
showPopup();
@@ -252,7 +252,7 @@ void MountButton::showPopup()
if (mPopup->isVisible())
return;
- if (mManager.devices()->isEmpty())
+ if (mManager.devices().isEmpty())
return;
mPopup->updateGeometry();

0 comments on commit 11bf65e

Please sign in to comment.