Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
c200ec93
Commit
c200ec93
authored
Dec 22, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: eeschemas sometimes crashes after a component with aliases is modified in libedit
parent
b24118eb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
48 deletions
+33
-48
class_libentry.cpp
eeschema/class_libentry.cpp
+3
-3
class_libentry.h
eeschema/class_libentry.h
+3
-1
class_library.cpp
eeschema/class_library.cpp
+27
-44
No files found.
eeschema/class_libentry.cpp
View file @
c200ec93
...
...
@@ -126,13 +126,13 @@ int LibraryEntryCompare( const CMP_LIB_ENTRY* aItem1, const CMP_LIB_ENTRY* aItem
* (like 74LS00, 74HC00 ... and many op amps )
*/
LIB_ALIAS
::
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
aComponent
,
LIB_ALIAS
::
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
a
Root
Component
,
CMP_LIBRARY
*
aLibrary
)
:
CMP_LIB_ENTRY
(
ALIAS
,
aName
,
aLibrary
)
{
wxASSERT
(
a
Component
!=
NULL
&&
a
Component
->
isComponent
()
);
wxASSERT
(
a
RootComponent
!=
NULL
&&
aRoot
Component
->
isComponent
()
);
root
=
aComponent
;
root
=
a
Root
Component
;
}
...
...
eeschema/class_libentry.h
View file @
c200ec93
...
...
@@ -515,11 +515,13 @@ protected:
* @note - Do not delete the root component. The root component is owned
* by library the component is part of. Deleting the root component
* will likely cause EESchema to crash.
* Or, if the root component is deleted, aliases must be deleted or their .root member
* must be changed to point a new root component
*/
LIB_COMPONENT
*
root
;
public
:
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
aComponent
,
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
a
Root
Component
,
CMP_LIBRARY
*
aLibrary
=
NULL
);
LIB_ALIAS
(
LIB_ALIAS
&
aAlias
,
CMP_LIBRARY
*
aLibrary
=
NULL
);
~
LIB_ALIAS
();
...
...
eeschema/class_library.cpp
View file @
c200ec93
...
...
@@ -356,60 +356,43 @@ library <%s>" ),
LIB_COMPONENT
*
CMP_LIBRARY
::
ReplaceComponent
(
LIB_COMPONENT
*
aOldComponent
,
LIB_COMPONENT
*
aNewComponent
)
{
wxASSERT
(
aOldComponent
!=
NULL
&&
aNewComponent
!=
NULL
&&
aOldComponent
->
GetName
().
CmpNoCase
(
aNewComponent
->
GetName
()
)
==
0
);
wxASSERT
(
aOldComponent
!=
NULL
);
wxASSERT
(
aNewComponent
!=
NULL
);
wxASSERT
(
aOldComponent
->
GetName
().
CmpNoCase
(
aNewComponent
->
GetName
()
)
==
0
);
size_t
i
;
int
index
;
LIB_ALIAS
*
alias
;
if
(
aOldComponent
->
m_AliasList
!=
aNewComponent
->
m_AliasList
)
{
/* Remove extra aliases. */
LIB_COMPONENT
*
newCmp
=
new
LIB_COMPONENT
(
*
aNewComponent
,
this
);
/* We want to remove the old root component, so we must remove old aliases.
* even if they are not modified, because their root component will be removed
*/
for
(
i
=
0
;
i
<
aOldComponent
->
m_AliasList
.
GetCount
();
i
++
)
{
index
=
aNewComponent
->
m_AliasList
.
Index
(
aOldComponent
->
m_AliasList
[
i
]
);
if
(
index
!=
wxNOT_FOUND
)
continue
;
wxLogDebug
(
wxT
(
"Removing extra alias <%s> from component <%s> in library <%s>."
),
/* wxLogDebug( wxT( "Removing alias <%s> from component <%s> in library <%s>." ),
GetChars( aOldComponent->m_AliasList[ i ] ),
GetChars( aOldComponent->GetName() ),
GetChars( fileName.GetName() ) );
*/
RemoveEntry
(
aOldComponent
->
m_AliasList
[
i
]
);
}
/* Add new
aliases. */
/* Now, add current
aliases. */
for
(
i
=
0
;
i
<
aNewComponent
->
m_AliasList
.
GetCount
();
i
++
)
{
index
=
aOldComponent
->
m_AliasList
.
Index
(
aNewComponent
->
m_AliasList
[
i
]
);
if
(
index
!=
wxNOT_FOUND
||
FindEntry
(
aNewComponent
->
m_AliasList
[
i
]
)
!=
NULL
)
continue
;
wxLogDebug
(
wxT
(
"Adding extra alias <%s> from component <%s> in library <%s>."
),
/* wxLogDebug( wxT( "Adding alias <%s> from component <%s> in library <%s>." ),
GetChars( aNewComponent->m_AliasList[ i ] ),
GetChars( aNewComponent->GetName() ),
GetChars( fileName.GetName() ) );
alias
=
new
LIB_ALIAS
(
aNewComponent
->
m_AliasList
[
i
],
aNewComponent
);
*/
LIB_ALIAS
*
alias
=
new
LIB_ALIAS
(
aNewComponent
->
m_AliasList
[
i
],
newCmp
);
entries
.
push_back
(
alias
);
}
}
RemoveEntry
(
aOldComponent
->
GetName
()
);
LIB_COMPONENT
*
newCmp
=
new
LIB_COMPONENT
(
*
aNewComponent
,
this
);
if
(
newCmp
==
NULL
)
return
NULL
;
entries
.
push_back
(
(
CMP_LIB_ENTRY
*
)
newCmp
);
entries
.
sort
();
isModified
=
true
;
return
newCmp
;
}
...
...
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