summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-02-20 22:08:16 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-02-20 22:08:16 +0200
commit020f153f1fed09c1cbeb5393098198c3f4bd49df (patch)
treee24626b29f0052d9b0336d325b381dcc02cdc7b7
parentBe explicit about the captured parameters in lambdas (diff)
downloadnheko-020f153f1fed09c1cbeb5393098198c3f4bd49df.tar.xz
Fix crash when trying to use automatically deleted ImageOverlay dialog
-rw-r--r--include/timeline/widgets/ImageItem.h1
-rw-r--r--src/timeline/widgets/ImageItem.cc5
2 files changed, 2 insertions, 4 deletions
diff --git a/include/timeline/widgets/ImageItem.h b/include/timeline/widgets/ImageItem.h
index 21d91b52..a95104fb 100644
--- a/include/timeline/widgets/ImageItem.h
+++ b/include/timeline/widgets/ImageItem.h
@@ -79,5 +79,4 @@ private:
         mtx::events::RoomEvent<mtx::events::msg::Image> event_;
 
         QSharedPointer<MatrixClient> client_;
-        QSharedPointer<dialogs::ImageOverlay> image_dialog_;
 };
diff --git a/src/timeline/widgets/ImageItem.cc b/src/timeline/widgets/ImageItem.cc
index 08a057da..83ab96b1 100644
--- a/src/timeline/widgets/ImageItem.cc
+++ b/src/timeline/widgets/ImageItem.cc
@@ -150,9 +150,8 @@ ImageItem::mousePressEvent(QMouseEvent *event)
         if (textRegion_.contains(event->pos())) {
                 openUrl();
         } else {
-                image_dialog_ =
-                  QSharedPointer<dialogs::ImageOverlay>(new dialogs::ImageOverlay(image_, this));
-                image_dialog_->show();
+                auto imgDialog = new dialogs::ImageOverlay(image_);
+                imgDialog->show();
         }
 }