Apple告诉我,我的应用程序在启动时崩溃了.这是崩溃报告,但我不知道它意味着什么.可能的原因是什么?
CrashReporter Key: 8ebc5eb666109db6d4970a4148cf88160f6805b5
Hardware Model: xxx
Process: Music Player [907]
Path: /private/var/mobile/Containers/Bundle/Application/664B5DFA-4F34-4469-B30D-EC43B25F39E0/Music Player.app/Music Player
Version: 1.0 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-01-17 10:11:49.478 -0800
Launch Time: 2015-01-17 10:11:28.916 -0800
OS Version: iOS 8.1 (12B410)
Report Version: 105
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.ceto.ocakonbes failed to scene-create in time
Elapsed total CPU time (seconds): 0.270 (user 0.270, system 0.000), 8% CPU
Elapsed application CPU time (seconds): 0.007, 0% …Run Code Online (Sandbox Code Playgroud) 我有一个非常奇怪的问题,试图在分配的内存上调用free导致我的程序崩溃.
这是相关的代码:
int i, count;
char *specifier;
char aisle[1];
count = 0;
/*Find name of the new item and assign to the name field of new_node...*/
for (i = 0; input[i] != ','; i++){
count++;
}
specifier = (char*)malloc((count+1)*sizeof(char));
if (specifier == NULL){
printf("Out of memory. Shutting down.\n");
exit(EXIT_FAILURE);
}
for (i = 0; input[i] != ','; i++){
specifier[i] = input[i];
}
specifier[count+1] = '\0';
new_node->name = specifier;
printf("%s\n", new_node->name);
free(specifier); /*PROGRAM CRASHES HERE*/
printf("boom\n");
specifier = NULL;
/*Function continues …Run Code Online (Sandbox Code Playgroud) 我已经开始编写一个程序,可以在一个结构中读取和存储团队信息和存储,重新排序并打印结果.
首先,我正在尝试阅读团队名称并将其存储在结构中的成员中,然后阅读团队分数并将其存储在另一个成员中.
但是,只要我调试文件,它就会崩溃.它甚至没有正确启动.我收到这个错误
PA2.exe中0xFEFEFEFE处的未处理异常:0xC0000005访问冲突执行位置0xFEFEFEFE.
我已经回溯到足以弄清楚它是在while循环中的某个地方,但无法弄清楚它有什么问题.
我正在使用visual studio 2012,当我构建它时我没有错误.
#include "stdafx.h"
#include "string.h"
#include <stdio.h>
struct team
{
char name[20];
int no_games;
int points;
int goals_scored;
int goals_let;
};
int main(void)
{
FILE *input2a;
FILE *input2b;
int error1;
int error2;
int i;
char team1_name[20];
char team2_name[20];
int team1_goals;
int team2_goals;
struct team teamlist[20];
error1 = fopen_s(&input2a, "C:\\Users\\New PC\\Desktop\\input2a.dat", "r");
i = 0;
while (i < 20)
{
i ++;
fscanf_s(input2a, "%s", teamlist[i].name);
}
error2 = fopen_s(&input2b, "C:\\Users\\New PC\\Desktop\\input2b.dat", "r");
while (fscanf_s(input2b, …Run Code Online (Sandbox Code Playgroud) 我在我的 C++ 游戏中使用 SDL2,并且我正在尝试实现即时进入和退出全屏的能力(老实说,我只是最大化窗口)。问题是,每次我调用SDL_MaximizeWindowor 时SDL_RestoreWindow,它都会立即因段错误而崩溃,转储堆栈并退出。请注意,当我用鼠标手动调整窗口大小时,它也会这样做。
这是一些有用的数据:
void init()
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
SDL_CreateWindowAndRenderer(320 * 2, 240 * 2, SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE, &sdlWindow, &sdlRenderer);
SDL_RenderSetLogicalSize(sdlRenderer, 320, 240);
MAIN_SCREEN = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, 320, 240);
}
void toggleFullscreen()
{
if(SDL_GetWindowFlags(sdlWindow) & SDL_WINDOW_MAXIMIZED)
SDL_RestoreWindow(sdlWindow);
else
SDL_MaximizeWindow(sdlWindow);
}
Run Code Online (Sandbox Code Playgroud)
每次手动调整大小和每次调用toggleFullscreen. 我正在 Windows 上通过 mingw-w64 和 Msys2 使用 g++ 进行编译,这是堆栈转储。
Exception: STATUS_ACCESS_VIOLATION at rip=0006C79976B
rax=0000000000000000 rbx=0000000000000000 rcx=0000000000000000
rdx=0000000002F1BE20 rsi=000000000004DD80 rdi=0000000000046078
r8 =00000000FFFFC66C r9 =00000000FFFFC800 r10=0000000000000001
r11=0000000000000000 r12=00000000FFFFC800 r13=0000000000040010
r14=0000000000000001 r15=000000018021CE41 …Run Code Online (Sandbox Code Playgroud) 我正在深入研究C中的指针,但是当我写一个简单的代码来解决这个问题时.
IDE:Code :: Blocks
操作系统:Windows 8.1
#include <stdio.h>
int main(){
int x;
x = 6;
int* p;
*p = &x; // This is wrong
printf("%d\n",*p);
}
Run Code Online (Sandbox Code Playgroud) 这个代码和它在“尝试!”时崩溃,但我不知道如何捕捉错误并且它是明确的,否则它将无法工作。
func downloadPicture2(finished: () -> Void) {
let imageUrlString = self.payments[indexPath.row].picture
let imageUrl = URL(string: imageUrlString!)!
let imageData = try! Data(contentsOf: imageUrl)
cell.profilePicture.image = UIImage(data: imageData)
cell.profilePicture.layer.cornerRadius = cell.profilePicture.frame.size.width / 2
cell.profilePicture.clipsToBounds = true
}
Run Code Online (Sandbox Code Playgroud) 我有以下宏用于读取 STM32F091 寄存器中的单个位:
#define GET_BIT(reg, pos) (((reg)>>(pos))&0x00000001u)
Run Code Online (Sandbox Code Playgroud)
我必须将这个宏与这两个参数一起使用:
#define FLASH_KEYR (*((u32_t *)(0x40022004u)))
#define BSY_FLASH_SR_POS (0u)
Run Code Online (Sandbox Code Playgroud)
使用此宏来评估单个变量时我没有任何问题,例如:
uint32_t value = GET_BIT(FLASH_SR, BSY_FLASH_SR_POS);
Run Code Online (Sandbox Code Playgroud)
但是,在这样的条件语句上使用这个宏:
while (GET_BIT(FLASH_SR, BSY_FLASH_SR_POS) == 1u);
Run Code Online (Sandbox Code Playgroud)
微型进入硬故障的 ISR。
...为什么?
所以我的问题是,当其中一个代码无法在服务器中找到该文件时,我的代码会崩溃.有没有办法在找不到文件时跳过查找过程并继续循环.这是我的代码如下:
fname = '/Volumes/database/interpro/data/'+uniprotID+'.txt'
for index, (start, end) in enumerate(searchPFAM(fname)):
with open('output_'+uniprotID+'-%s.txt' % index,'w') as fileinput:
print start, end
for item in lookup[uniprotID]:
item, start, end = map(int, (item, start, end)) #make sure that all value is int
if start <= item <= end:
print item
result = str(item - start)
fileinput.write(">{0} | at position {1} \n".format(uniprotID, result))
fileinput.write(''.join(makeList[start-1:end]))
break
else:
fileinput.write(">{0} | N/A\n".format(uniprotID))
fileinput.write(''.join(makeList[start-1:end]))
Run Code Online (Sandbox Code Playgroud)
fname = '/Volumes/database/interpro/data/'+uniprotID+'.txt'
for index, (start, end) in enumerate(searchPFAM(fname)):
with open('output_'+uniprotID+'-%s.txt' % index,'w') as fileinput: …
Run Code Online (Sandbox Code Playgroud) 无论出于何种原因,我的代码崩溃了,但只有在退出程序之后(通过点击"X"),任何人都知道它为什么这样做?这是我的代码.
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <windows.h>
#include <time.h>
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
using namespace std;
/*
const int AIR = 0;
const int STONE = 1;
const int DIRT = 3;
const int GRASS = 4;
*/
float SCALE = .5;
const int chunkSize = 16;
const int chunkSizeY = 256;
const int blocksTotal = 4;
int chunk[chunkSize][chunkSizeY][chunkSize];
time_t seconds;
int seed = 0;
int quads;
struct block {
bool Solid;
int DepthMAX; …Run Code Online (Sandbox Code Playgroud) 我知道这是一个愚蠢的问题,但我不知道为什么会这样.这是我的代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Button button = (Button)findViewById(R.id.button2);
button.setText("Blabla");
setContentView(R.layout.activity_aiueo);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
Run Code Online (Sandbox Code Playgroud)
片段XML:
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Next"
android:layout_weight="1"
android:onClick="next" />
Run Code Online (Sandbox Code Playgroud)
我只想在启动活动时更改文本,但它会使我的应用程序崩溃.
logcat的
06-23 15:42:05.396: E/AndroidRuntime(13039): FATAL EXCEPTION: main
06-23 15:42:05.396: E/AndroidRuntime(13039): Process: com.shinway.hiragana, PID: 13039
06-23 15:42:05.396: E/AndroidRuntime(13039): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shinway.hiragana/com.shinway.hiragana.table.Aiueo}: java.lang.NullPointerException
06-23 15:42:05.396: E/AndroidRuntime(13039): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215)
06-23 15:42:05.396: E/AndroidRuntime(13039): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
06-23 15:42:05.396: E/AndroidRuntime(13039): at android.app.ActivityThread.access$800(ActivityThread.java:145)
06-23 15:42:05.396: E/AndroidRuntime(13039): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
06-23 …Run Code Online (Sandbox Code Playgroud)