这是valgrind的输出..
Conditional jump or move depends on uninitialised value(s)
in RingsWidget::UpdateSeekBar() in ringswidget.cpp:514
1: RingsWidget::UpdateSeekBar() in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/../NomadDesktop/ringswidget.cpp:514" >ringswidget.cpp:514</a>
2: RingsWidget::UpdateRings() in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/../NomadDesktop/ringswidget.cpp:138" >ringswidget.cpp:138</a>
3: RingsWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/moc_ringswidget.cpp:49" >/media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/moc_ringswidget.cpp:49</a>
4: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) in /usr/lib/libQtCore.so.4.8.4
5: QObject::event(QEvent*) in /usr/lib/libQtCore.so.4.8.4
6: QApplicationPrivate::notify_helper(QObject*, QEvent*) in /usr/lib/libQtGui.so.4.8.4
7: QApplication::notify(QObject*, QEvent*) in /usr/lib/libQtGui.so.4.8.4
8: QCoreApplication::notifyInternal(QObject*, QEvent*) in /usr/lib/libQtCore.so.4.8.4
9: /usr/lib/libQtCore.so.4.8.4
10: /usr/lib/libQtCore.so.4.8.4
11: g_main_context_dispatch in /usr/lib/libglib-2.0.so.0.3400.3
12: /usr/lib/libglib-2.0.so.0.3400.3
13: g_main_context_iteration in /usr/lib/libglib-2.0.so.0.3400.3
14: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in /usr/lib/libQtCore.so.4.8.4
15: /usr/lib/libQtGui.so.4.8.4
16: QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in /usr/lib/libQtCore.so.4.8.4
17: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) in /usr/lib/libQtCore.so.4.8.4
18: QCoreApplication::exec() in /usr/lib/libQtCore.so.4.8.4
19: main in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/../NomadDesktop/main.cpp:19" >main.cpp:19</a>
Uninitialised value was created by a heap allocation 1: operator new(unsigned long) in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
2: MusicWidget::MusicWidget(QWidget*) in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/../NomadDesktop/musicwidget.cpp:148" >musicwidget.cpp:148</a>
3: NomadWindow::Initialize() in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/../NomadDesktop/nomadwindow.cpp:127" >nomadwindow.cpp:127</a>
4: NomadWindow::NomadWindow(QWidget*) in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/../NomadDesktop/nomadwindow.cpp:27" >nomadwindow.cpp:27</a>
5: main in <a href="file:///media/dipesh/Documents/Qt-projects/NomadDesktop-build-Desktop-Debug/../NomadDesktop/main.cpp:15" >main.cpp:15</a>
这是代码..
511 NomadWindow *par = (NomadWindow*)parent();
512 float percentage = par->GetMusicWidget()->GetMPDSeekPerc();
513 settings[5].operator []("value") = percentage;
514 if ( percentage < 0.2 )
515 settings[5].operator []("fg_alpha") = 0.2;
516 else
517 settings[5].operator []("fg_alpha") = percentage;
valgrind 输出来自第 514 行 if ( percent < 0.2 )
我做错了什么?提前致谢..