diff -r 3663b9de2121 -r 7cf4b7bc3d5a eric7/EricWidgets/EricIconBar.py --- a/eric7/EricWidgets/EricIconBar.py Sat Sep 11 12:48:59 2021 +0200 +++ b/eric7/EricWidgets/EricIconBar.py Sat Sep 11 13:40:06 2021 +0200 @@ -166,10 +166,9 @@ iconLabel = self.__layout.itemAt(index) if iconLabel: widget = iconLabel.widget() - if widget: - widget.setFixedSize(self.__barSize, self.__barSize) - widget.setPixmap( - icon.pixmap(self.__barSize, self.__barSize)) + widget.setFixedSize(self.__barSize, self.__barSize) + widget.setPixmap( + icon.pixmap(self.__barSize, self.__barSize)) def barSize(self): """ @@ -272,14 +271,15 @@ @type int """ label = self.__layout.itemAt(index) - self.__layout.removeWidget(label) - with contextlib.suppress(IndexError): - del self.__icons[index] - - if index == self.__currentIndex: - self.setCurrentIndex(index) - elif index < self.__currentIndex: - self.setCurrentIndex(self.__currentIndex - 1) + if label: + self.__layout.removeWidget(label.widget()) + with contextlib.suppress(IndexError): + del self.__icons[index] + + if index == self.__currentIndex: + self.setCurrentIndex(index) + elif index < self.__currentIndex: + self.setCurrentIndex(self.__currentIndex - 1) @pyqtSlot() def __iconClicked(self, label):