boxed: Track ownership of boxed pointer better

This is the second bug of this type that I've fixed since refactoring
this code, so clearly we need to do something differently. We rename
m_not_owning_ptr to m_owning_ptr and make sure it starts out false (so
that we never try to free a pointer if it wasn't assigned yet.) Then we
introduce two methods for setting the m_ptr field: own_ptr() which sets
m_owning_ptr, and share_ptr() which does not. We use these methods
consistently everywhere that we previously set m_ptr directly.

Closes: #240
27 jobs for 240-fix-boxed-pointer-ownership in 12 minutes and 37 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Source Check
passed #278581
cppcheck

00:01:19

passed #278582
cpplint

00:01:32

passed #278583
eslint

00:01:18

passed #278580
fedora

00:02:56

 
  Test
passed #278587
no_graphics

00:04:20

passed #278588
no_profiler

00:04:57

passed #278589
no_readline

00:04:50

passed #278658
sanitizer_gcc

00:04:39

passed #278585
with_logging

00:05:01

passed #278586
with_systemtap

00:04:58

failed #278584
sanitizer_gcc

00:05:04

 
  Manual
manual #278603
allowed to fail manual
armv8
manual #278590
allowed to fail manual
codequality
manual #278591
allowed to fail manual
code_statistics
manual #278605
allowed to fail manual
coverage
manual #278593
allowed to fail manual
fedora_gcc
manual #278599
allowed to fail manual
flatpak
manual #278594
allowed to fail manual
installed_tests
manual #278597
allowed to fail manual
lts
manual #278604
allowed to fail manual
ppc64le
manual #278592
allowed to fail manual
sanitizer_clang
manual #278596
allowed to fail manual
ubuntu_clang
manual #278595
allowed to fail manual
ubuntu_gcc
manual #278598
allowed to fail manual
valgrind
manual #278602
allowed to fail manual
zeal_11
manual #278600
allowed to fail manual
zeal_2
manual #278601
allowed to fail manual
zeal_4