Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
71bbef82
Commit
71bbef82
authored
May 16, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed another smart pointer bug (assignment operator copied ref count);
Fixed symbol editor grid
parent
4ae62eec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
22 deletions
+15
-22
src/gui/symbol/control.cpp
src/gui/symbol/control.cpp
+2
-2
src/util/smart_ptr.hpp
src/util/smart_ptr.hpp
+13
-20
No files found.
src/gui/symbol/control.cpp
View file @
71bbef82
...
...
@@ -150,9 +150,9 @@ void SymbolControl::draw(DC& dc) {
// draw grid
if
(
settings
.
symbol_grid
)
{
wxSize
s
=
dc
.
GetSize
();
int
lines
=
settings
.
symbol_grid_size
;
double
lines
=
settings
.
symbol_grid_size
;
for
(
int
i
=
0
;
i
<=
lines
;
++
i
)
{
int
x
=
(
int
)
rotation
.
trS
(
i
/
lines
-
0.0001
);
int
x
=
floor
(
rotation
.
trS
(
i
/
lines
-
0.0001
)
);
//dc.SetPen(Color(0, i%5 == 0 ? 64 : 31, 0));
//dc.SetPen(Color(i%5 == 0 ? 64 : 31, 0, 0));
dc
.
SetLogicalFunction
(
wxAND
);
...
...
src/util/smart_ptr.hpp
View file @
71bbef82
...
...
@@ -160,7 +160,15 @@ inline shared_ptr<T> new_shared9(const A0& a0, const A1& a1, const A2& a2, const
template
<
typename
T
>
class
IntrusivePtrBase
{
public:
inline
IntrusivePtrBase
()
:
ref_count
(
0
)
{}
inline
IntrusivePtrBase
(
const
IntrusivePtrBase
&
)
:
ref_count
(
0
)
{}
// don't copy construct the reference count!
// don't copy construct the reference count!
inline
IntrusivePtrBase
(
const
IntrusivePtrBase
&
)
:
ref_count
(
0
)
{}
// don't assign the reference count!
inline
void
operator
=
(
const
IntrusivePtrBase
&
)
{
}
protected:
/// Delete this object, can be overloaded
inline
void
destroy
()
{
delete
static_cast
<
T
*>
(
this
);
}
private:
AtomicInt
ref_count
;
template
<
typename
T
>
friend
void
intrusive_ptr_add_ref
(
IntrusivePtrBase
*
);
...
...
@@ -172,7 +180,7 @@ inline shared_ptr<T> new_shared9(const A0& a0, const A1& a1, const A2& a2, const
}
template
<
typename
T
>
inline
void
intrusive_ptr_release
(
IntrusivePtrBase
<
T
>*
p
)
{
if
(
--
p
->
ref_count
==
0
)
{
delete
static_cast
<
T
*>
(
p
);
static_cast
<
T
*>
(
p
)
->
destroy
(
);
}
}
...
...
@@ -187,32 +195,17 @@ inline shared_ptr<T> new_shared9(const A0& a0, const A1& a1, const A2& a2, const
// ----------------------------------------------------------------------------- : Intrusive pointer base : with delete
/// Base class for objects wishing to use intrusive_ptrs, using a manual delete function
class
IntrusivePtrBaseWithDelete
{
class
IntrusivePtrBaseWithDelete
:
public
IntrusivePtrBase
<
IntrusivePtrBaseWithDelete
>
{
public:
inline
IntrusivePtrBaseWithDelete
()
:
ref_count
(
0
)
{}
inline
IntrusivePtrBaseWithDelete
(
const
IntrusivePtrBaseWithDelete
&
)
:
ref_count
(
0
)
{}
// don't copy construct the reference count!
virtual
~
IntrusivePtrBaseWithDelete
()
{}
protected:
/// Delete this object
virtual
void
destroy
()
{
delete
this
;
}
private:
AtomicInt
ref_count
;
friend
void
intrusive_ptr_add_ref
(
IntrusivePtrBaseWithDelete
*
);
friend
void
intrusive_ptr_release
(
IntrusivePtrBaseWithDelete
*
);
template
<
typename
T
>
friend
void
intrusive_ptr_release
(
IntrusivePtrBase
<
T
>*
);
};
inline
void
intrusive_ptr_add_ref
(
IntrusivePtrBaseWithDelete
*
p
)
{
++
p
->
ref_count
;
}
inline
void
intrusive_ptr_release
(
IntrusivePtrBaseWithDelete
*
p
)
{
if
(
--
p
->
ref_count
==
0
)
{
p
->
destroy
();
}
}
#else
#define DECLARE_POINTER_TYPE DECLARE_SHARED_POINTER_TYPE
#define intrusive_ptr shared_ptr
...
...
@@ -235,7 +228,7 @@ inline shared_ptr<T> new_shared9(const A0& a0, const A1& a1, const A2& a2, const
virtual
~
IntrusivePtrVirtualBase
()
{}
};
class
IntrusivePtrBaseWithDelete
{
class
IntrusivePtrBaseWithDelete
:
public
IntrusivePtrBase
<
IntrusivePtrBaseWithDelete
>
{
public:
virtual
~
IntrusivePtrBaseWithDelete
()
{}
protected:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment