QT Creator上的QWindow程序将无法运行

时间:2011-08-03 15:46:13

标签: qt-creator

我在Qt Creator上创建了一个无错误构建的程序。但是当我尝试运行它时,我在输出窗格中得到以下内容。任何人都可以告诉我这意味着什么/如何解决这个问题?我将不胜感激任何帮助。

&"warning: GDB: Failed to set controlling terminal: Invalid argument\n"
*** glibc detected *** /home/test/Documents/Wave-build-desktop/Wave: double free or corruption (!prev): 0x000000000060b580 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x733b6)[0x7ffff5d423b6]
/lib64/libc.so.6(cfree+0x6c)[0x7ffff5d472dc]
/home/test/Documents/Wave-build-desktop/Wave[0x405359]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7ffff5cedbfd]
/home/test/Documents/Wave-build-desktop/Wave[0x4042b9]
======= Memory map: ========
00400000-00409000 r-xp 00000000 08:03 9962314                            /home/test/Documents/Wave-build-desktop/Wave
00608000-00609000 r--p 00008000 08:03 9962314                            /home/test/Documents/Wave-build-desktop/Wave
00609000-0060a000 rw-p 00009000 08:03 9962314                            /home/test/Documents/Wave-build-desktop/Wave
0060a000-0062b000 rw-p 00000000 00:00 0                                  [heap]
7fffec000000-7fffec021000 rw-p 00000000 00:00 0 
7fffec021000-7ffff0000000 ---p 00000000 00:00 0 
7ffff083c000-7ffff283d000 rw-p 00000000 00:00 0 
7ffff283d000-7ffff283f000 r-xp 00000000 08:03 3806318                    /usr/lib64/libXau.so.6.0.0
7ffff283f000-7ffff2a3f000 ---p 00002000 08:03 3806318                    /usr/lib64/libXau.so.6.0.0
7ffff2a3f000-7ffff2a40000 r--p 00002000 08:03 3806318                    /usr/lib64/libXau.so.6.0.0
7ffff2a40000-7ffff2a41000 rw-p 00003000 08:03 3806318                    /usr/lib64/libXau.so.6.0.0
7ffff2a41000-7ffff2a5d000 r-xp 00000000 08:03 3806425                    /usr/lib64/libxcb.so.1.1.0
7ffff2a5d000-7ffff2c5c000 ---p 0001c000 08:03 3806425                    /usr/lib64/libxcb.so.1.1.0
7ffff2c5c000-7ffff2c5d000 r--p 0001b000 08:03 3806425                    /usr/lib64/libxcb.so.1.1.0
7ffff2c5d000-7ffff2c5e000 rw-p 0001c000 08:03 3806425                    /usr/lib64/libxcb.so.1.1.0
7ffff2c5e000-7ffff2c85000 r-xp 00000000 08:03 10747978                   /lib64/libexpat.so.1.5.2
7ffff2c85000-7ffff2e85000 ---p 00027000 08:03 10747978                   /lib64/libexpat.so.1.5.2
7ffff2e85000-7ffff2e87000 r--p 00027000 08:03 10747978                   /lib64/libexpat.so.1.5.2
7ffff2e87000-7ffff2e88000 rw-p 00029000 08:03 10747978                   /lib64/libexpat.so.1.5.2
7ffff2e88000-7ffff2e8c000 r-xp 00000000 08:03 10748069                   /lib64/libuuid.so.1.3.0
7ffff2e8c000-7ffff308b000 ---p 00004000 08:03 10748069                   /lib64/libuuid.so.1.3.0
7ffff308b000-7ffff308c000 r--p 00003000 08:03 10748069                   /lib64/libuuid.so.1.3.0
7ffff308c000-7ffff308d000 rw-p 00004000 08:03 10748069                   /lib64/libuuid.so.1.3.0
7ffff308d000-7ffff30c2000 r-xp 00000000 08:03 10747968                   /lib64/libpcre.so.0.0.1
7ffff30c2000-7ffff32c1000 ---p 00035000 08:03 10747968                   /lib64/libpcre.so.0.0.1
7ffff32c1000-7ffff32c2000 r--p 00034000 08:03 10747968                   /lib64/libpcre.so.0.0.1
7ffff32c2000-7ffff32c3000 rw-p 00035000 08:03 10747968                   /lib64/libpcre.so.0.0.1
7ffff32c3000-7ffff32c7000 r-xp 00000000 08:03 10748045                   /lib64/libgthread-2.0.so.0.2800.0
7ffff32c7000-7ffff34c6000 ---p 00004000 08:03 10748045                   /lib64/libgthread-2.0.so.0.2800.0
7ffff34c6000-7ffff34c7000 r--p 00003000 08:03 10748045                   /lib64/libgthread-2.0.so.0.2800.0
7ffff34c7000-7ffff34c8000 rw-p 00004000 08:03 10748045                   /lib64/libgthread-2.0.so.0.2800.0
7ffff34c8000-7ffff3605000 r-xp 00000000 08:03 3806790                    /usr/lib64/libX11.so.6.3.0
7ffff3605000-7ffff3805000 ---p 0013d000 08:03 3806790                    /usr/lib64/libX11.so.6.3.0
7ffff3805000-7ffff3806000 r--p 0013d000 08:03 3806790                    /usr/lib64/libX11.so.6.3.0
7ffff3806000-7ffff380b000 rw-p 0013e000 08:03 3806790                    /usr/lib64/libX11.so.6.3.0
7ffff380b000-7ffff381d000 r-xp 00000000 08:03 3807691                    /usr/lib64/libXext.so.6.4.0
7ffff381d000-7ffff3a1c000 ---p 00012000 08:03 3807691                    /usr/lib64/libXext.so.6.4.0
7ffff3a1c000-7ffff3a1d000 r--p 00011000 08:03 3807691                    /usr/lib64/libXext.so.6.4.0
7ffff3a1d000-7ffff3a1e000 rw-p 00012000 08:03 3807691                    /usr/lib64/libXext.so.6.4.0
7ffff3a1e000-7ffff3a53000 r-xp 00000000 08:03 3806497                    /usr/lib64/libfontconfig.so.1.4.4
7ffff3a53000-7ffff3c53000 ---p 00035000 08:03 3806497                    /usr/lib64/libfontconfig.so.1.4.4
7ffff3c53000-7ffff3c54000 r--p 00035000 08:03 3806497                    /usr/lib64/libfontconfig.so.1.4.4
7ffff3c54000-7ffff3c55000 rw-p 00036000 08:03 3806497                    /usr/lib64/libfontconfig.so.1.4.4
7ffff3c55000-7ffff3c57000 r-xp 00000000 08:03 3808118                    /usr/lib64/libXinerama.so.1.0.0
7ffff3c57000-7ffff3e56000 ---p 00002000 08:03 3808118                    /usr/lib64/libXinerama.so.1.0.0
7ffff3e56000-7ffff3e57000 r--p 00001000 08:03 3808118                    /usr/lib64/libXinerama.so.1.0.0
7ffff3e57000-7ffff3e58000 rw-p 00002000 08:03 3808118                    /usr/lib64/libXinerama.so.1.0.0
7ffff3e58000-7ffff3e62000 r-xp 00000000 08:03 3808106                    /usr/lib64/libXcursor.so.1.0.2
7ffff3e62000-7ffff4061000 ---p 0000a000 08:03 3808106                    /usr/lib64/libXcursor.so.1.0.2
7ffff4061000-7ffff4062000 r--p 00009000 08:03 3808106                    /usr/lib64/libXcursor.so.1.0.2
7ffff4062000-7ffff4063000 rw-p 0000a000 08:03 3808106                    /usr/lib64/libXcursor.so.1.0.2
7ffff4063000-7ffff4068000 r-xp 00000000 08:03 3807689                    /usr/lib64/libXfixes.so.3.1.0
7ffff4068000-7ffff4267000 ---p 00005000 08:03 3807689                    /usr/lib64/libXfixes.so.3.1.0
7ffff4267000-7ffff4268000 r--p 00004000 08:03 3807689                    /usr/lib64/libXfixes.so.3.1.0
7ffff4268000-7ffff4269000 rw-p 00005000 08:03 3807689                    /usr/lib64/libXfixes.so.3.1.0
7ffff4269000-7ffff4271000 r-xp 00000000 08:03 3808122                    /usr/lib64/libXrandr.so.2.2.0
7ffff4271000-7ffff4470000 ---p 00008000 08:03 3808122                    /usr/lib64/libXrandr.so.2.2.0
7ffff4470000-7ffff4471000 r--p 00007000 08:03 3808122                    /usr/lib64/libXrandr.so.2.2.0
7ffff4471000-7ffff4472000 rw-p 00008000 08:03 3808122                    /usr/lib64/libXrandr.so.2.2.0
7ffff4472000-7ffff447c000 r-xp 00000000 08:03 3807681                    /usr/lib64/libXrender.so.1.3.0
7ffff447c000-7ffff467b000 ---p 0000a000 08:03 3807681                    /usr/lib64/libXrender.so.1.3.0
7ffff467b000-7ffff467c000 r--p 00009000 08:03 3807681                    /usr/lib64/libXrender.so.1.3.0
7ffff467c000-7ffff467d000 rw-p 0000a000 08:03 3807681                    /usr/lib64/libXrender.so.1.3.0
7ffff467d000-7ffff468c000 r-xp 00000000 08:03 3807981                    /usr/lib64/libXi.so.6.1.0
7ffff468c000-7ffff488b000 ---p 0000f000 08:03 3807981                    /usr/lib64/libXi.so.6.1.0
7ffff488b000-7ffff488c000 r--p 0000e000 08:03 3807981                    /usr/lib64/libXi.so.6.1.0
7ffff488c000-7ffff488d000 rw-p 0000f000 08:03 3807981                    /usr/lib64/libXi.so.6.1.0
7ffff488d000-7ffff48a4000 r-xp 00000000 08:03 3806320                    /usr/lib64/libICE.so.6.3.0
7ffff48a4000-7ffff4aa4000 ---p 00017000 08:03 3806320                    /usr/lib64/libICE.so.6.3.0
7ffff4aa4000-7ffff4aa5000 r--p 00017000 08:03 3806320                    /usr/lib64/libICE.so.6.3.0
7ffff4aa5000-7ffff4aa6000 rw-p 00018000 08:03 3806320                    /usr/lib64/libICE.so.6.3.0
7ffff4aa6000-7ffff4aaa000 rw-p 00000000 00:00 0 
7ffff4aaa000-7ffff4ab1000 r-xp 00000000 08:03 3806608                    /usr/lib64/libSM.so.6.0.1
7ffff4ab1000-7ffff4cb1000 ---p 00007000 08:03 3806608                    /usr/lib64/libSM.so.6.0.1
7ffff4cb1000-7ffff4cb2000 r--p 00007000 08:03 3806608                    /usr/lib64/libSM.so.6.0.1
7ffff4cb2000-7ffff4cb3000 rw-p 00008000 08:03 3806608                    /usr/lib64/libSM.so.6.0.1
7ffff4cb3000-7ffff4d01000 r-xp 00000000 08:03 10748064                   /lib64/libgobject-2.0.so.0.2800.0
7ffff4d01000-7ffff4f01000 ---p 0004e000 08:03 10748064                   /lib64/libgobject-2.0.so.0.2800.0
7ffff4f01000-7ffff4f02000 r--p 0004e000 08:03 10748064                   /lib64/libgobject-2.0.so.0.2800.0
7ffff4f02000-7ffff4f03000 rw-p 0004f000 08:03 10748064                   /lib64/libgobject-2.0.so.0.2800.0
7ffff4f03000-7ffff4f04000 rw-p 00000000 00:00 0 
7ffff4f04000-7ffff4f88000 r-xp 00000000 08:03 3806341                    /usr/lib64/libfreetype.so.6.6.2
7ffff4f88000-7ffff5188000 ---p 00084000 08:03 3806341                    /usr/lib64/libfreetype.so.6.6.2
7ffff5188000-7ffff518d000 r--p 00084000 08:03 3806341                    /usr/lib64/libfreetype.so.6.6.2
7ffff518d000-7ffff518e000 rw-p 00089000 08:03 3806341                    /usr/lib64/libfreetype.so.6.6.2
7ffff518e000-7ffff51a4000 r-xp 00000000 08:03 10748027                   /lib64/libz.so.1.2.5
7ffff51a4000-7ffff53a4000 ---p 00016000 08:03 10748027                   /lib64/libz.so.1.2.5
7ffff53a4000-7ffff53a5000 r--p 00016000 08:03 10748027                   /lib64/libz.so.1.2.5
7ffff53a5000-7ffff53a6000 rw-p 00017000 08:03 10748027                   /lib64/libz.so.1.2.5
7ffff53a6000-7ffff53cf000 r-xp 00000000 08:03 3806339                    /usr/lib64/libpng14.so.14.4.0
7ffff53cf000-7ffff55ce000 ---p 00029000 08:03 3806339                    /usr/lib64/libpng14.so.14.4.0
7ffff55ce000-7ffff55cf000 r--p 00028000 08:03 3806339                    /usr/lib64/libpng14.so.14.4.0
7ffff55cf000-7ffff55d0000 rw-p 00029000 08:03 3806339                    /usr/lib64/libpng14.so.14.4.0
7ffff55d0000-7ffff56c0000 r-xp 00000000 08:03 10748033                   /lib64/libglib-2.0.so.0.2800.0
7ffff56c0000-7ffff58bf000 ---p 000f0000 08:03 10748033                   /lib64/libglib-2.0.so.0.2800.0
7ffff58bf000-7ffff58c0000 r--p 000ef000 08:03 10748033                   /lib64/libglib-2.0.so.0.2800.0
7ffff58c0000-7ffff58c1000 rw-p 000f0000 08:03 10748033                   /lib64/libglib-2.0.so.0.2800.0
7ffff58c1000-7ffff58c2000 rw-p 00000000 00:00 0 
7ffff58c2000-7ffff58ca000 r-xp 00000000 08:03 10747943                   /lib64/librt-2.11.3.so
7ffff58ca000-7ffff5ac9000 ---p 00008000 08:03 10747943                   /lib64/librt-2.11.3.so
7ffff5ac9000-7ffff5aca000 r--p 00007000 08:03 10747943                   /lib64/librt-2.11.3.so
7ffff5aca000-7ffff5acb000 rw-p 00008000 08:03 10747943                   /lib64/librt-2.11.3.so
7ffff5acb000-7ffff5acd000 r-xp 00000000 08:03 10747919                   /lib64/libdl-2.11.3.so
7ffff5acd000-7ffff5ccd000 ---p 00002000 08:03 10747919                   /lib64/libdl-2.11.3.so
7ffff5ccd000-7ffff5cce000 r--p 00002000 08:03 10747919                   /lib64/libdl-2.11.3.so
7ffff5cce000-7ffff5ccf000 rw-p 00003000 08:03 10747919                   /lib64/libdl-2.11.3.so
7ffff5ccf000-7ffff5e33000 r-xp 00000000 08:03 10747913                   /lib64/libc-2.11.3.so
7ffff5e33000-7ffff6032000 ---p 00164000 08:03 10747913                   /lib64/libc-2.11.3.so
7ffff6032000-7ffff6036000 r--p 00163000 08:03 10747913                   /lib64/libc-2.11.3.so
7ffff6036000-7ffff6037000 rw-p 00167000 08:03 10747913                   /lib64/libc-2.11.3.so
7ffff6037000-7ffff603c000 rw-p 00000000 00:00 0 
7ffff603c000-7ffff6051000 r-xp 00000000 08:03 10748067                   /lib64/libgcc_s.so.1
7ffff6051000-7ffff6250000 ---p 00015000 08:03 10748067                   /lib64/libgcc_s.so.1
7ffff6250000-7ffff6251000 r--p 00014000 08:03 10748067                   /lib64/libgcc_s.so.1
7ffff6251000-7ffff6252000 rw-p 00015000 08:03 10748067                   /lib64/libgcc_s.so.1
7ffff6252000-7ffff62a8000 r-xp 00000000 08:03 10747921                   /lib64/libm-2.11.3.so
7ffff62a8000-7ffff64a7000 ---p 00056000 08:03 10747921                   /lib64/libm-2.11.3.so
7ffff64a7000-7ffff64a8000 r--p 00055000 08:03 10747921                   /lib64/libm-2.11.3.so
7ffff64a8000-7ffff64a9000 rw-p 00056000 08:03 10747921                   /lib64/libm-2.11.3.so
7ffff64a9000-7ffff6594000 r-xp 00000000 08:03 3806566                    /usr/lib64/libstdc++.so.6.0.14
7ffff6594000-7ffff6793000 ---p 000eb000 08:03 3806566                    /usr/lib64/libstdc++.so.6.0.14
7ffff6793000-7ffff679b000 r--p 000ea000 08:03 3806566                    /usr/lib64/libstdc++.so.6.0.14
7ffff679b000-7ffff679d000 rw-p 000f2000 08:03 3806566                    /usr/lib64/libstdc++.so.6.0.14
7ffff679d000-7ffff67b2000 rw-p 00000000 00:00 0 
7ffff67b2000-7ffff67c9000 r-xp 00000000 08:03 10747939                   /lib64/libpthread-2.11.3.so
7ffff67c9000-7ffff69c9000 ---p 00017000 08:03 10747939                   /lib64/libpthread-2.11.3.so
7ffff69c9000-7ffff69ca000 r--p 00017000 08:03 10747939                   /lib64/libpthread-2.11.3.so
7ffff69ca000-7ffff69cb000 rw-p 00018000 08:03 10747939                   /lib64/libpthread-2.11.3.so
7ffff69cb000-7ffff69cf000 rw-p 00000000 00:00 0 
7ffff69cf000-7ffff6c59000 r-xp 00000000 08:03 3808046                    /usr/lib64/libQtCore.so.4.7.1
7ffff6c59000-7ffff6e58000 ---p 0028a000 08:03 3808046                    /usr/lib64/libQtCore.so.4.7.1
7ffff6e58000-7ffff6e63000 r--p 00289000 08:03 3808046                    /usr/lib64/libQtCore.so.4.7.1
7ffff6e63000-7ffff6e64000 rw-p 00294000 08:03 3808046                    /usr/lib64/libQtCore.so.4.7.1
7ffff6e64000-7ffff6e65000 rw-p 00000000 00:00 0 
7ffff6e65000-7ffff78b8000 r-xp 00000000 08:03 3808607                    /usr/lib64/libQtGui.so.4.7.1
7ffff78b8000-7ffff7ab8000 ---p 00a53000 08:03 3808607                    /usr/lib64/libQtGui.so.4.7.1
7ffff7ab8000-7ffff7af7000 r--p 00a53000 08:03 3808607                    /usr/lib64/libQtGui.so.4.7.1
7ffff7af7000-7ffff7afe000 rw-p 00a92000 08:03 3808607                    /usr/lib64/libQtGui.so.4.7.1
7ffff7afe000-7ffff7b01000 rw-p 00000000 00:00 0 
7ffff7b01000-7ffff7bd9000 r-xp 00000000 08:03 3806311                    /usr/lib64/libasound.so.2.0.0
7ffff7bd9000-7ffff7dd8000 ---p 000d8000 08:03 3806311                    /usr/lib64/libasound.so.2.0.0
7ffff7dd8000-7ffff7dde000 r--p 000d7000 08:03 3806311                    /usr/lib64/libasound.so.2.0.0
7ffff7dde000-7ffff7ddf000 rw-p 000dd000 08:03 3806311                    /usr/lib64/libasound.so.2.0.0
7ffff7ddf000-7ffff7dfd000 r-xp 00000000 08:03 10747906                   /lib64/ld-2.11.3.so
7ffff7fcc000-7ffff7fdc000 rw-p 00000000 00:00 0 
7ffff7fe8000-7ffff7ff8000 rw-s 00000000 00:05 4435                       /dev/snd/pcmC0D0p
7ffff7ff8000-7ffff7ff9000 rw-s 81000000 00:05 4435                       /dev/snd/pcmC0D0p
7ffff7ff9000-7ffff7ffa000 r--s 80000000 00:05 4435                       /dev/snd/pcmC0D0p
7ffff7ffa000-7ffff7ffb000 rw-p 00000000 00:00 0 
7ffff7ffb000-7ffff7ffc000 r-xp 00000000 00:00 0                          [vdso]
7ffff7ffc000-7ffff7ffd000 r--p 0001d000 08:03 10747906                   /lib64/ld-2.11.3.so
7ffff7ffd000-7ffff7ffe000 rw-p 0001e000 08:03 10747906                   /lib64/ld-2.11.3.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0 
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0                          [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

main.cpp中:

  #include <QtGui>
    #include <QApplication>
    #include <qlineedit.h>
    #include "ui_wave.h"
    #include <QString>
    #include <QObject>
    #include <QDebug>
    #include <stdio.h>
    #include <cstdio>
    #include <stdlib.h>
    #include <cstdlib>
    #include <string.h>
    #include <cstring>
    #include <sched.h>
    #include <errno.h>
    #include <getopt.h>
    #include <alsa/asoundlib.h>
    #include <sys/time.h>
    #include <sstream>
    #include <string>
    #include <math.h>
    #include <cmath>
    #include <iostream>
    #include "wave.h"
    using namespace std;

    static const char *device = "plughw:0,0";             //   playback device
    static snd_pcm_format_t format = SND_PCM_FORMAT_S16;   //  sample format- change to 24-bit
    static unsigned int rate = 96000;                      //  stream rate
    static unsigned int channels = 128;                   //   count of channels
    static unsigned int buffer_time = 500000;               // ring buffer length in us
    static unsigned int period_time = 100000;               // period time in us
    static double freq;                                     // sinusoidal wave frequency in Hz
    static int verbose = 0;                                 // verbose flag
    static int resample = 1;                                // enable alsa-lib resampling
    static int period_event = 0;                // produce poll event after each period
    static snd_pcm_sframes_t buffer_size;
    static snd_pcm_sframes_t period_size;
    static snd_output_t *output = NULL;
    static double ampl;
    static snd_pcm_t *h;
    static bool isTrue;

   ....

    int main(int argc, char *argv[])
    {

            struct option long_option[] =
            {
                    {"help", 0, NULL, 'h'},
                    {"device", 1, NULL, 'D'},
                    {"rate", 1, NULL, 'r'},
                    {"channels", 1, NULL, 'c'},
                    {"frequency", 1, NULL, 'f'},
                    {"buffer", 1, NULL, 'b'},
                    {"period", 1, NULL, 'p'},
                    {"method", 1, NULL, 'm'},
                    {"format", 1, NULL, 'o'},
                    {"verbose", 1, NULL, 'v'},
                    {"noresample", 1, NULL, 'n'},
                    {"pevent", 1, NULL, 'e'},
                    {NULL, 0, NULL, 0},
            };
            int err, morehelp;
            snd_pcm_hw_params_t *hwparams;
            snd_pcm_sw_params_t *swparams;
            int method = 0;
            short int *samp;
            snd_pcm_t *h;
            snd_pcm_channel_area_t *area;
            snd_pcm_t *handle = (snd_pcm_t*) h;
            unsigned char *samples  = (unsigned char*) samp;
            unsigned int chn;
            snd_pcm_channel_area_t *areas = (snd_pcm_channel_area_t*) area;

            snd_pcm_hw_params_alloca(&hwparams);
            snd_pcm_sw_params_alloca(&swparams);


            err = snd_output_stdio_attach(&output, stdout, 0);
            if (err < 0) {
                    printf("Output failed: %s\n", snd_strerror(err));
                    return 0;
            }
    //    cout<<"Playback device is %s  "<<","<< device);
       //     cout<<"Stream parameters are %iHz, %s, %i channels  "<<","<< rate<<","<< snd_pcm_format_name(format), channels;
       //     cout<<"Sine wave rate is %.4fHz  "<<","<< freq;
        //    cout<<"Using transfer method: %s  "<<","<< transfer_methods[method].name;

            if ((err = snd_pcm_open(&h, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
                    printf("Playback open error: %s\n", snd_strerror(err));
                    return 0;
            }

            if ((err = set_hwparams(h, hwparams, transfer_methods[method].access)) < 0) {
                    printf("Setting of hwparams failed: %s\n", snd_strerror(err));
                    exit(EXIT_FAILURE);
            }

            if ((err = set_swparams(h, swparams)) < 0) {
                    printf("Setting of swparams failed: %s\n", snd_strerror(err));
                    exit(EXIT_FAILURE);
            }

            if (verbose > 0)
                    snd_pcm_dump(h, output);

            samp = new short int [period_size * channels * snd_pcm_format_physical_width(format)];


            if (samp == NULL) {
                    printf("Not enough memory\n");
                    exit(EXIT_FAILURE);
            }

            area = new snd_pcm_channel_area_t [channels, sizeof(snd_pcm_channel_area_t)];
            if (area == NULL) {
                    printf("Not enough memory\n");
                    exit(EXIT_FAILURE);
            }
            for (chn = 0; chn < channels; chn++) {
                    area[chn].addr = samp;
                    area[chn].first = chn * snd_pcm_format_physical_width(format);
                    area[chn].step = channels * snd_pcm_format_physical_width(format);
            }

           err = write_loop(h, samp, area);
            if (err < 0)
                    printf("Transfer failed: %s\n", snd_strerror(err));

            delete(area);
            delete(samp);
            snd_pcm_close(h);
            return 0;


    QApplication a(argc, argv);
        wave w;
        w.show();

        return a.exec();

    }

3 个答案:

答案 0 :(得分:0)

一些源代码会很好。 看起来你正试图删除两次。

答案 1 :(得分:0)

如果您无法在调试中发现此问题,那么您可以分析刚刚发布的回溯,以查找程序中的哪个函数导致此问题。首先执行nm ./NameOfYourProgram以获取符号列表。符号列表还显示每个函数的地址。您的回溯中的地址将大于或等于符号地址。您需要在回溯中查看的功能是:

/家/测试/文档/波积聚桌面/波[0x405359]
...
/ home / test / Documents / Wave-build-desktop / Wave [0x4042b9]

这里的地址是:0x405359和0x4042b9。然后,您可以单步执行找到的函数并在0x405359处停止,您将在代码中找到发生异常的确切行。

答案 2 :(得分:0)

这个重要的一行是:

  

检测到glibc * * * / home / test / Documents / Wave-build-desktop / Wave: 双重免费 或损坏(!prev):0x000000000060b580 *