Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Improvement: Detect self reference on 'Insert...'

Abierto
#915 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp
Área
devtools

Línea de trabajo

The issue asks for an assertion that InsertEndChild (and the InsertChildElement() path it calls) rejects a child pointer equal to this. Start in tinyxml2.cpp where XMLNode::InsertEndChild is defined and find where the insertion takes place. Add a check there, then run the existing tests to confirm they still pass. Done means a self-insertion trips the assert immediately, not later during document teardown. The payload does not say whether maintainers want this, and nobody has replied in 1548 days.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hi there,

today I managed to produce a stupid error by copy&pasting.

Here is the minimal code snipplet:

// <foo>
auto *pElement = xmlDoc.NewElement("foo");
pElement->InsertEndChild( pElement );
/\
|__ this should have been some other parent element

The problems with the construct is that it compiles and appears to run fine until the xmlDoc is destroyed.
Then some assertions in the clean up code are triggered. Now I could see that there was a problem, but it took me some hours to
understand (and finally see) what the problem was.

I suggest to add an assertion that the pointer handed to 'InsertChildElement()' is != this
What do you think?

Best regards,
Sven

Lenguaje dominante
C++
Estrellas
5.8k
Forks
2k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de leethomason/tinyxml2

Todos los issues de leethomason/tinyxml2

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.