Attempt to fix crash in the ticket 515.

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent b9c2e8d6bc
commit 8fb0036b2a
  1. 13
      src/gui/UBLibNavigatorWidget.cpp
  2. 5
      src/gui/UBLibPathViewer.cpp
  3. 5
      src/gui/UBLibraryWidget.cpp
  4. 3
      src/gui/UBLibraryWidget.h

@ -126,11 +126,14 @@ void UBLibNavigatorWidget::onNavigbarUpate(UBLibElement *pElem)
*/ */
void UBLibNavigatorWidget::onPathItemClicked(UBChainedLibElement *elem) void UBLibNavigatorWidget::onPathItemClicked(UBChainedLibElement *elem)
{ {
// If this element has some subelement, remove them if (!this->libraryWidget()->isLoadingLibraryItems())
removeNextChainedElements(elem); {
// If this element has some subelement, remove them
// The refresh the view removeNextChainedElements(elem);
mLibWidget->setCurrentElemsAndRefresh(elem);
// The refresh the view
mLibWidget->setCurrentElemsAndRefresh(elem);
}
} }
/** /**

@ -405,9 +405,10 @@ void UBPathScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if(NULL != pView) if(NULL != pView)
{ {
int iClickedItem = pView->widgetAt(event->scenePos()); int iClickedItem = pView->widgetAt(event->scenePos());
if(-1 != iClickedItem) QGraphicsLayout* wgtLayout = pGWidget->layout();
if(iClickedItem != -1 && wgtLayout != NULL)
{ {
QGraphicsWidget* pFolderW = dynamic_cast<QGraphicsWidget*>(pGWidget->layout()->itemAt(iClickedItem)); QGraphicsWidget* pFolderW = dynamic_cast<QGraphicsWidget*>(wgtLayout->itemAt(iClickedItem));
if(NULL != pFolderW) if(NULL != pFolderW)
{ {
UBChainedLibElement* chElem = mMapWidgetToChainedElem[pFolderW]; UBChainedLibElement* chElem = mMapWidgetToChainedElem[pFolderW];

@ -43,6 +43,7 @@ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailW
, mpCrntDir(NULL) , mpCrntDir(NULL)
, mpCrntElem(NULL) , mpCrntElem(NULL)
, mpTmpElem(NULL) , mpTmpElem(NULL)
, mLoadingLibraryItems(false)
{ {
setObjectName(name); setObjectName(name);
setSpacing(5); setSpacing(5);
@ -147,7 +148,8 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
Q_UNUSED(index); Q_UNUSED(index);
if(NULL != item) if(NULL != item)
{ {
int iItem = mGraphicItems.indexOf(item); mLoadingLibraryItems = true;
int iItem = mGraphicItems.indexOf(item);
if(0 <= iItem) if(0 <= iItem)
{ {
UBLibElement* pElem = mCurrentElems.at(iItem); UBLibElement* pElem = mCurrentElems.at(iItem);
@ -183,6 +185,7 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
} }
emit itemClicked(); emit itemClicked();
} }
mLoadingLibraryItems = false;
} }
} }

@ -48,6 +48,7 @@ public:
void init(); void init();
UBLibraryController* libraryController() {return mLibraryController;} UBLibraryController* libraryController() {return mLibraryController;}
bool isLoadingLibraryItems() const { return mLoadingLibraryItems; }
public slots: public slots:
void onRefreshCurrentFolder(); void onRefreshCurrentFolder();
@ -92,7 +93,7 @@ private:
QList<UBLibElement*> mCurrentElems; QList<UBLibElement*> mCurrentElems;
QList<UBLibElement*> mOrigCurrentElems; QList<UBLibElement*> mOrigCurrentElems;
QList<QGraphicsItem*> mItems; QList<QGraphicsItem*> mItems;
bool mLoadingLibraryItems;
}; };
class UBNewFolderDlg : public QDialog class UBNewFolderDlg : public QDialog

Loading…
Cancel
Save