Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ChaosWars

SDL segfaults on window resize

This topic is 5241 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a small program which renders a textured cube, based on NeHe''s tutorials. I incorporated SDL into it to make it portable. Then, because I thought it would be neat, I wrote a bit of it in Qt so that when the program is started, the user is represented with a window so that they can choose wether or not they want to run in fullscreen, and in what resolution. The program works fine, except when one tries to resize the window in windowed mode, SDL segfaults and the message "Deploying SDL parachute" is generated. The program didn''t do this before I modified it to start up with the Qt window first. Does anyone know whats'' causing this? I suspect a conflict between Qt and SDL - I''ve tried debugging it but to no avail. Here''s a link to the source : http://www.warmachine.demon.nl/teflon.tar.bz2 Here''s the gdb output :
/bin/sh -c /home/valheru/Qt/KDevelop/teflon/debug/libtool gdb /home/valheru/Qt/KDevelop/teflon/debug/src/teflon -fullname -nx -quiet
(gdb) set edit off 
(gdb) set confirm off 
*** Warning: inferring the mode of operation is deprecated.
*** Future versions of Libtool will require -mode=MODE be specified.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) 
(gdb) 
(gdb) set print static-members off 
(gdb) tty /dev/pts/4 
(gdb) set width 0 
(gdb) set height 0 
(gdb) set stop-on 1 
(gdb) handle SIG32 pass nostop noprint 
(gdb) handle SIG43 pass nostop noprint 
(gdb) set print asm-demangle on 
(gdb) cd /home/valheru/Qt/KDevelop/teflon/debug/src 
(gdb) run 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 

Program received signal SIGSEGV, Segmentation fault.
0x0804ea07 in TeflonSDL::processEvents(SDL_VideoInfo const*) (this=0x8ae8d60, info=0x646e6957) at /home/valheru/Qt/KDevelop/teflon/src/teflonSDL.cpp:128
/home/valheru/Qt/KDevelop/teflon/src/teflonSDL.cpp:128:3604:beg:0x804ea07
(gdb) backtrace 
#0  0x0804ea07 in TeflonSDL::processEvents(SDL_VideoInfo const*) (this=0x8ae8d60, info=0x646e6957) at /home/valheru/Qt/KDevelop/teflon/src/teflonSDL.cpp:128
#1  0x0804ebec in TeflonMW::OKSlot() (this=0xbffff350) at teflonmw.ui.h:47
#2  0x08050bc4 in TeflonMW::qt_invoke(int, QUObject*) (this=0xbffff350, _id=60, _o=0xbfffea00) at /home/valheru/Qt/KDevelop/teflon/src/moc_teflonmw.cpp:84
#3  0x4e47af8c in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/qt/3/lib/libqt-mt.so.3
#4  0x4e47adc4 in QObject::activate_signal(int) () from /usr/qt/3/lib/libqt-mt.so.3
#5  0x4e7b0fde in QButton::clicked() () from /usr/qt/3/lib/libqt-mt.so.3
#6  0x4e50ac8a in QButton::mouseReleaseEvent(QMouseEvent*) () from /usr/qt/3/lib/libqt-mt.so.3
#7  0x4e4b0667 in QWidget::event(QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3
#8  0x4e41fd4f in QApplication::internalNotify(QObject*, QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3
#9  0x4e41f210 in QApplication::notify(QObject*, QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3
#10 0x4e3b6f10 in QETWidget::translateMouseEvent(_XEvent const*) () from /usr/qt/3/lib/libqt-mt.so.3
#11 0x4e3b4ba0 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/qt/3/lib/libqt-mt.so.3
#12 0x4e3cbaa1 in QEventLoop::processEvents(unsigned) () from /usr/qt/3/lib/libqt-mt.so.3
#13 0x4e431d68 in QEventLoop::enterLoop() () from /usr/qt/3/lib/libqt-mt.so.3
#14 0x4e431c18 in QEventLoop::exec() () from /usr/qt/3/lib/libqt-mt.so.3
#15 0x4e41ffa1 in QApplication::exec() () from /usr/qt/3/lib/libqt-mt.so.3
#16 0x0804d512 in main (argc=1, argv=0xbffff4b4) at /home/valheru/Qt/KDevelop/teflon/src/main.cpp:31
(gdb) frame 0 
#0  0x0804ea07 in TeflonSDL::processEvents(SDL_VideoInfo const*) (this=0x8ae8d60, info=0x646e6957) at /home/valheru/Qt/KDevelop/teflon/src/teflonSDL.cpp:128
/home/valheru/Qt/KDevelop/teflon/src/teflonSDL.cpp:128:3604:beg:0x804ea07
(gdb) disassemble 0x804ea07 0x804ea87 
Dump of assembler code from 0x804ea07 to 0x804ea87:
0x0804ea07 <TeflonSDL::processEvents(SDL_VideoInfo const*)+69>:	mov    0x8(%eax),%eax
0x0804ea0a <TeflonSDL::processEvents(SDL_VideoInfo const*)+72>:	movzbl 0x4(%eax),%eax
0x0804ea0e <TeflonSDL::processEvents(SDL_VideoInfo const*)+76>:	mov    %eax,0x8(%esp,1)
0x0804ea12 <TeflonSDL::processEvents(SDL_VideoInfo const*)+80>:	mov    0xffffffe0(%ebp),%eax
0x0804ea15 <TeflonSDL::processEvents(SDL_VideoInfo const*)+83>:	mov    %eax,0x4(%esp,1)
0x0804ea19 <TeflonSDL::processEvents(SDL_VideoInfo const*)+87>:	mov    0xffffffdc(%ebp),%eax
0x0804ea1c <TeflonSDL::processEvents(SDL_VideoInfo const*)+90>:	mov    %eax,(%esp,1)
0x0804ea1f <TeflonSDL::processEvents(SDL_VideoInfo const*)+93>:	call   0x804d29c
0x0804ea24 <TeflonSDL::processEvents(SDL_VideoInfo const*)+98>:	mov    %eax,(%ebx)
0x0804ea26 <TeflonSDL::processEvents(SDL_VideoInfo const*)+100>:	mov    0x8(%ebp),%eax
0x0804ea29 <TeflonSDL::processEvents(SDL_VideoInfo const*)+103>:	cmpl   $0x0,(%eax)
0x0804ea2c <Teflon
SDL::processEvents(SDL_VideoInfo const*)+106>:	jne    0x804ea56 <TeflonSDL::processEvents(SDL_VideoInfo const*)+148>
0x0804ea2e <TeflonSDL::processEvents(SDL_VideoInfo const*)+108>:	call   0x804ce0c
0x0804ea33 <TeflonSDL::processEvents(SDL_VideoInfo const*)+113>:	mov    %eax,0x4(%esp,1)
0x0804ea37 <TeflonSDL::processEvents(SDL_VideoInfo const*)+117>:	movl   $0x80512c0,(%esp,1)
0x0804ea3e <TeflonSDL::processEvents(SDL_VideoInfo const*)+124>:	call   0x804cf0c
0x0804ea43 <TeflonSDL::processEvents(SDL_VideoInfo const*)+129>:	movl   $0x1,0x4(%esp,1)
0x0804ea4b <TeflonSDL::processEvents(SDL_VideoInfo const*)+137>:	mov    0x8(%ebp),%eax
0x0804ea4e <TeflonSDL::processEvents(SDL_VideoInfo const*)+140>:	mov    %eax,(%esp,1)
0x0804ea51 <TeflonSDL::processEvents(SDL_VideoInfo const*)+143>:	call   0x804e49c <TeflonSDL::quit(int)>
0x0804ea56 <TeflonSDL::processEvents(SDL_VideoInfo const*)+148>:	mov    0xffffffe0(%ebp),%eax
0x0804ea59 <TeflonSDL::processEvents(SDL_VideoInfo const*)+151>:	mov    %eax,0x8(%esp,1)
0x0804ea5d <
TeflonSDL::processEvents(SDL_VideoInfo const*)+155>:	mov    0xffffffdc(%ebp),%eax
0x0804ea60 <TeflonSDL::processEvents(SDL_VideoInfo const*)+158>:	mov    %eax,0x4(%esp,1)
0x0804ea64 <TeflonSDL::processEvents(SDL_VideoInfo const*)+162>:	mov    0x8(%ebp),%eax
0x0804ea67 <TeflonSDL::processEvents(SDL_VideoInfo const*)+165>:	mov    %eax,(%esp,1)
0x0804ea6a <TeflonSDL::processEvents(SDL_VideoInfo const*)+168>:	call   0x804e848 <TeflonSDL::resizeSDL(int, int)>
0x0804ea6f <TeflonSDL::processEvents(SDL_VideoInfo const*)+173>:	jmp    0x804e9ca <TeflonSDL::processEvents(SDL_VideoInfo const*)+8>
0x0804ea74 <TeflonSDL::processEvents(SDL_VideoInfo const*)+178>:	lea    0xffffffd8(%ebp),%eax
0x0804ea77 <TeflonSDL::processEvents(SDL_VideoInfo const*)+181>:	add    $0x4,%eax
0x0804ea7a <TeflonSDL::processEvents(SDL_VideoInfo const*)+184>:	mov    %eax,0x4(%esp,1)
0x0804ea7e <TeflonSDL::processEvents(SDL_VideoInfo const*)+188>:	mov    0x8(%ebp),%eax
0x0804ea81 <TeflonSDL::processEvents(SDL_VideoInfo const*)+191>:	mov    %eax,(%e
sp,1)
0x0804ea84 <TeflonSDL::processEvents(SDL_VideoInfo const*)+194>:	call   0x804e882 <TeflonSDL::processKeyPress(SDL_keysym*)>
End of assembler dump.
And here''s the output from the dissasembler :
0x0804ea07 <TeflonSDL::processEvents(SDL_VideoInfo const*)+69>:	mov    0x8(%eax),%eax
0x0804ea0a <TeflonSDL::processEvents(SDL_VideoInfo const*)+72>:	movzbl 0x4(%eax),%eax
0x0804ea0e <TeflonSDL::processEvents(SDL_VideoInfo const*)+76>:	mov    %eax,0x8(%esp,1)
0x0804ea12 <TeflonSDL::processEvents(SDL_VideoInfo const*)+80>:	mov    0xffffffe0(%ebp),%eax
0x0804ea15 <TeflonSDL::processEvents(SDL_VideoInfo const*)+83>:	mov    %eax,0x4(%esp,1)
0x0804ea19 <TeflonSDL::processEvents(SDL_VideoInfo const*)+87>:	mov    0xffffffdc(%ebp),%eax
0x0804ea1c <TeflonSDL::processEvents(SDL_VideoInfo const*)+90>:	mov    %eax,(%esp,1)
0x0804ea1f <TeflonSDL::processEvents(SDL_VideoInfo const*)+93>:	call   0x804d29c
0x0804ea24 <TeflonSDL::processEvents(SDL_VideoInfo const*)+98>:	mov    %eax,(%ebx)
0x0804ea26 <TeflonSDL::processEvents(SDL_VideoInfo const*)+100>:	mov    0x8(%ebp),%eax
0x0804ea29 <TeflonSDL::processEvents(SDL_VideoInfo const*)+103>:	cmpl   $0x0,(%eax)
0x0804ea2c <TeflonSDL::processEvents(SDL_VideoInfo const*)+106>:	jne    0x804ea56 <TeflonSDL::processEvents(SDL_VideoInfo const*)+148>
0x0804ea2e <TeflonSDL::processEvents(SDL_VideoInfo const*)+108>:	call   0x804ce0c
0x0804ea33 <TeflonSDL::processEvents(SDL_VideoInfo const*)+113>:	mov    %eax,0x4(%esp,1)
0x0804ea37 <TeflonSDL::processEvents(SDL_VideoInfo const*)+117>:	movl   $0x80512c0,(%esp,1)
0x0804ea3e <TeflonSDL::processEvents(SDL_VideoInfo const*)+124>:	call   0x804cf0c
0x0804ea43 <TeflonSDL::processEvents(SDL_VideoInfo const*)+129>:	movl   $0x1,0x4(%esp,1)
0x0804ea4b <TeflonSDL::processEvents(SDL_VideoInfo const*)+137>:	mov    0x8(%ebp),%eax
0x0804ea4e <TeflonSDL::processEvents(SDL_VideoInfo const*)+140>:	mov    %eax,(%esp,1)
0x0804ea51 <TeflonSDL::processEvents(SDL_VideoInfo const*)+143>:	call   0x804e49c <TeflonSDL::quit(int)>
0x0804ea56 <TeflonSDL::processEvents(SDL_VideoInfo const*)+148>:	mov    0xffffffe0(%ebp),%eax
0x0804ea59 <TeflonSDL::processEvents(SDL_VideoInfo const*)+151>:	mov    %eax,0x8(%esp,1)
0x0804ea5d <TeflonSDL::processEvents(SDL_VideoInfo const*)+155>:	mov    0xffffffdc(%ebp),%eax
0x0804ea60 <TeflonSDL::processEvents(SDL_VideoInfo const*)+158>:	mov    %eax,0x4(%esp,1)
0x0804ea64 <TeflonSDL::processEvents(SDL_VideoInfo const*)+162>:	mov    0x8(%ebp),%eax
0x0804ea67 <TeflonSDL::processEvents(SDL_VideoInfo const*)+165>:	mov    %eax,(%esp,1)
0x0804ea6a <TeflonSDL::processEvents(SDL_VideoInfo const*)+168>:	call   0x804e848 <TeflonSDL::resizeSDL(int, int)>
0x0804ea6f <TeflonSDL::processEvents(SDL_VideoInfo const*)+173>:	jmp    0x804e9ca <TeflonSDL::processEvents(SDL_VideoInfo const*)+8>
0x0804ea74 <TeflonSDL::processEvents(SDL_VideoInfo const*)+178>:	lea    0xffffffd8(%ebp),%eax
0x0804ea77 <TeflonSDL::processEvents(SDL_VideoInfo const*)+181>:	add    $0x4,%eax
0x0804ea7a <TeflonSDL::processEvents(SDL_VideoInfo const*)+184>:	mov    %eax,0x4(%esp,1)
0x0804ea7e <TeflonSDL::processEvents(SDL_VideoInfo const*)+188>:	mov    0x8(%ebp),%eax
0x0804ea81 <TeflonSDL::processEvents(SDL_VideoInfo const*)+191>:	mov    %eax,(%esp,1)
0x0804ea84 <TeflonSDL::processEvents(SDL_VideoInfo const*)+194>:	call   0x804e882 <TeflonSDL::processKeyPress(SDL_keysym*)>
Might it be because the Qt window is destroyed prior to the initialisation of the SDL part?

Share this post


Link to post
Share on other sites
Advertisement
probably not the best forum for this qeusiton, but anyway...

You''re using Qt and SDL? Where did you find the code to do this sort of thing, because the only method I know of is a NASTY hack with environment variables...

Share this post


Link to post
Share on other sites
Err, I made up the code myself :/

Take a look at the source code, its'' not that difficult to implement. I''m not happy with the way I''ve done it, I''m convinced that there''s a more elegant solution, but it works.

I''ve just discovered that the program still segfaults when I remove the Qt specific code and just run it using SDL, so there''s something else wrong with the code. I must have changed something along the line that messed it up. Bugger.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!