Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes #5

Open
motching opened this issue Jun 3, 2019 · 9 comments
Open

Crashes #5

motching opened this issue Jun 3, 2019 · 9 comments

Comments

@motching
Copy link
Contributor

motching commented Jun 3, 2019

GTimer crashes a lot when I add a new task and try to start it. Saving the task helps.

My gut feeling is some unininitialized pointer leads to segfault. If if fix it, would you accept a PR?

@craigk5n
Copy link
Owner

craigk5n commented Jun 3, 2019

Sure, I always accept PRs for bug fixes.

@motching
Copy link
Contributor Author

motching commented Jun 3, 2019

Now that I compiled and am looking at the code, it won't crash of course, lol... I'll try to recognize the pattern which breaks it in my day-to-day workflow. Great software but that bug is quite annoying.

In the meantime I submitted a PR for another little thorn in my side: the delete key binding is clashing with the one for annotation so I have to right-click and delete all my tasks periodically.

@craigk5n
Copy link
Owner

craigk5n commented Jun 3, 2019

Let me know if you can identify the other bug.

@motching
Copy link
Contributor Author

motching commented Jun 3, 2019

image

It's indeed a segfault, see screenshot.

Can you maybe give me a pointer how would you track this down? I'm not a wizard level at debugging C to say the least, I guess I need to get a stack trace somehow. Thanks!

(GTK error probably not related, those appear all the time)

@craigk5n
Copy link
Owner

I would build gtimer with debug symbols:

./configure "CFLAGS=-g"
make clean; make

and then start it using gdb:

gdb gtimer

Then, just use the run command for gdb to startup gtimer. The gdb debugger should catch the point where the crash happens and you can let me know what file and line number this happens.

@motching
Copy link
Contributor Author

image

main.c, line 1121

It crashed when I added a new task and pressed Alt-S to start it. I looked at it a for a bit but I wouldn't go into guesses what's happening, I'm curious about your opinion. Thanks.

(If you dump your thougths here I might be able to do some of the legwork tracking it down :) )

@craigk5n
Copy link
Owner

Curious.... I would be interested to know what the value of the st variable (selected task number). It sounds like a valid task number is being returned and the assignment for td = visible_tasks[st] is returning an invalid memory address. Try changing the start_callback function's if clause to the following:

static void start_callback ( GtkAction *act )
{
  TaskData *td;
  int st = get_selected_task ();

  if ( st < 0 || st >= num_visible_tasks ) {

This may avoid the crash, but it suggests there is a bug somewhere else that is not fixed...

@motching
Copy link
Contributor Author

OK, thanks, I changed it, I also log st... waiting for the next crash.

BTW I have to manually set this env variable when configuring, to pass the X11 library, I'm not sure if this is specific to my system or should be put in the configure script.

LIBS=-lX11 ./configure "CFLAGS=-g"

@motching
Copy link
Contributor Author

That particular one didn't come back since I put in logging (typical), but FYI another segfault happened:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants