[glibmm/refptr_as_sharedptr_v3: 3/6] glibmm_weakref: Don't try to use moved-from RefPtrs.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/refptr_as_sharedptr_v3: 3/6] glibmm_weakref: Don't try to use moved-from RefPtrs.
- Date: Sun, 11 Dec 2016 20:51:54 +0000 (UTC)
commit 30b95005256ceb844d5571b86425764bb4d29522
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Apr 10 12:46:27 2016 +0200
glibmm_weakref: Don't try to use moved-from RefPtrs.
tests/glibmm_weakref/main.cc | 21 ++++++---------------
1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/tests/glibmm_weakref/main.cc b/tests/glibmm_weakref/main.cc
index 20a8031..ae8edf1 100644
--- a/tests/glibmm_weakref/main.cc
+++ b/tests/glibmm_weakref/main.cc
@@ -67,38 +67,29 @@ main(int, char**)
// Move construction.
Glib::WeakRef<Gio::MemoryInputStream> weakmemstream3(std::move(weakmemstream1));
- if (weakmemstream1.get() || !weakmemstream3.get())
+ if (!weakmemstream3.get())
{
success = false;
- if (weakmemstream1.get())
- std::cout << "weakmemstream1 || !weakmemstream3: weakmemstream1" << std::endl;
- if (!weakmemstream3.get())
- std::cout << "weakmemstream1 || !weakmemstream3: !weakmemstream3" << std::endl;
+ std::cout << "weakmemstream1 || !weakmemstream3: !weakmemstream3" << std::endl;
}
else
{
// Move assignment.
weakmemstream2 = std::move(weakmemstream3);
- if (!weakmemstream2 || weakmemstream3)
+ if (!weakmemstream2)
{
success = false;
- if (!weakmemstream2.get())
- std::cout << "!weakmemstream2 || weakmemstream3: !weakmemstream2" << std::endl;
- if (weakmemstream3.get())
- std::cout << "!weakmemstream2 || weakmemstream3: weakmemstream3" << std::endl;
+ std::cout << "!weakmemstream2 || weakmemstream3: !weakmemstream2" << std::endl;
}
else
{
// Downcast move, followed by upcast.
weakstream1 = std::move(weakmemstream2);
weakmemstream1 = Glib::WeakRef<Gio::MemoryInputStream>::cast_dynamic(weakstream1);
- if (weakmemstream2 || !weakmemstream1)
+ if (!weakmemstream1)
{
success = false;
- if (weakmemstream2)
- std::cout << "weakmemstream2 || !weakmemstream1: weakmemstream2" << std::endl;
- if (!weakmemstream1)
- std::cout << "weakmemstream2 || !weakmemstream1: !weakmemstream1" << std::endl;
+ std::cout << "weakmemstream2 || !weakmemstream1: !weakmemstream1" << std::endl;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]