Qucs / qucs

Qucs Project official mirror
http://qucs.sourceforge.net/
GNU General Public License v2.0
1.15k stars 213 forks source link

timingdiagram crash if dataset not present #122

Closed guitorri closed 9 years ago

guitorri commented 9 years ago

Issue: crash when trying to load a schematic containing a timingdiagram for which the dataset is missing. Reproduce: see attached files https://gist.github.com/guitorri/c204875db4ae20f89584

With 0.0.18 it loads and empty diagram. If you run with 0.0.18 it fills the diagram with data. With master if you try to open the attached .sch (or delete the dataset vhdl_vector.dat and open) the schematic with it crashes with (OSX):

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.qucs                        0x00000001054c363c Q3GList::count() const + 12 (q3glist.h:160)
1   org.qucs                        0x000000010590e0f5 Q3PtrList<DataX>::isEmpty() const + 21 (q3ptrlist.h:88)
2   org.qucs                        0x000000010592c99a TimingDiagram::calcDiagram() + 3178 (timingdiagram.cpp:171)
3   org.qucs                        0x00000001058fb05b Diagram::updateGraphData() + 43 (diagram.cpp:809)
4   org.qucs                        0x00000001058f930a Diagram::loadGraphData(QString const&) + 986 (diagram.cpp:771)
5   org.qucs                        0x00000001054e0844 Schematic::reloadGraphs() + 212 (schematic.cpp:1275)
yodalee commented 9 years ago

Can you see #28 I ran to a similar situation then. Maybe it's related?

guitorri commented 9 years ago

It looks like the same issue. Right now it points to: https://github.com/Qucs/qucs/blob/master/qucs/qucs/diagrams/timingdiagram.cpp#L171 Graph was ported to QList but cPointsX is still Q3PtrList.

yodalee commented 9 years ago

I use same way to send the patch, but maybe it's not the best way to do this.

guitorri commented 9 years ago

Your patch seems good.

yodalee commented 9 years ago

It's just a copy and paste (._.)

guitorri commented 9 years ago

Hehe, now I understood, you took it from the previous fix on truthdiagram.... :)

guitorri commented 9 years ago

Fixed in ad1ac336fa, thanks!