Bug 104 - segfault when the fx2lafw driver has two devices, and one is selected
Summary: segfault when the fx2lafw driver has two devices, and one is selected
Status: RESOLVED FIXED
Alias: None
Product: PulseView
Classification: Unclassified
Component: Other (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 45
  Show dependency treegraph
 
Reported: 2013-04-23 11:42 CEST by Bert Vermeulen
Modified: 2013-04-27 18:33 CEST (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bert Vermeulen 2013-04-23 11:42:15 CEST
1. Connect two devices handled by fx2lafw
2. File -> Connect to device
3. Select fx2lafw
3. hit "Scan for devices"
4. Select either device found, and hit OK.

Program received signal SIGSEGV, Segmentation fault.
0x00000000004799e1 in pv::toolbars::SamplingBar::set_device_list (this=
    0xafc150, devices=...)
    at /home/bert/sigrok/pulseview/pv/toolbars/samplingbar.cpp:123
123			if (sdi->vendor && sdi->vendor[0])
(gdb) bt
#0  0x00000000004799e1 in pv::toolbars::SamplingBar::set_device_list (
    this=0xafc150, devices=...)
    at /home/bert/sigrok/pulseview/pv/toolbars/samplingbar.cpp:123
#1  0x000000000045c3b9 in pv::MainWindow::on_actionConnect_triggered (
    this=0x7fffffffe3a0) at /home/bert/sigrok/pulseview/pv/mainwindow.cpp:267
#2  0x0000000000488e79 in pv::MainWindow::qt_static_metacall (
    _o=0x7fffffffe3a0, _c=QMetaObject::InvokeMetaMethod, _id=4, 
    _a=0x7fffffffcde0) at /home/bert/sigrok/pulseview/pv/moc_mainwindow.cxx:72
#3  0x0000000000489024 in pv::MainWindow::qt_metacall (this=0x7fffffffe3a0, 
    _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x7fffffffcde0)
    at /home/bert/sigrok/pulseview/pv/moc_mainwindow.cxx:117

(gdb) fr
#0  0x00000000004799e1 in pv::toolbars::SamplingBar::set_device_list (
    this=0xafc150, devices=...)
    at /home/bert/sigrok/pulseview/pv/toolbars/samplingbar.cpp:123
123			if (sdi->vendor && sdi->vendor[0])
(gdb) p *sdi
$1 = {driver = 0x0, index = 9485072, status = 0, inst_type = 1, 
  vendor = 0x4000400000030 <Address 0x4000400000030 out of bounds>, 
  model = 0x100000011 <Address 0x100000011 out of bounds>, 
  version = 0x21 <Address 0x21 out of bounds>, probes = 0xac2610, 
  conn = 0x3b9aca00, priv = 0x1}

(gdb) fr 1
#1  0x000000000045c3b9 in pv::MainWindow::on_actionConnect_triggered (
    this=0x7fffffffe3a0) at /home/bert/sigrok/pulseview/pv/mainwindow.cpp:267
267			_sampling_bar->set_device_list(_devices);
(gdb) p *sdi
$2 = {driver = 0x7ffff6821060 <fx2lafw_driver_info>, index = 0, 
  status = 10002, inst_type = 10000, vendor = 0x9e8a70 "Saleae", 
  model = 0xabbe90 "Logic", version = 0x0, probes = 0x786140, conn = 0x9262b0, 
  priv = 0xae6e40}
Comment 1 Bert Vermeulen 2013-04-23 12:09:14 CEST
Correction: I can also repeat this when only one fx2lafw is connected, but only sometimes. If I keep repeating steps 2-4, it eventually segfaults in the same place.
Comment 2 Joel Holdsworth 2013-04-25 23:58:40 CEST
I have a list of sdis that I get by scanning the drivers at startup.

Then any device selected in the manual connection dialog gets added to that list.

Except in the case of your bug the fx2lafw sdis from the original scan are no longer valid pointers.
Comment 3 Bert Vermeulen 2013-04-27 18:33:34 CEST
Fixed in 50c604f