Opened 18 years ago

Last modified 18 years ago

#675 closed bug

Dragging (zip) file onto StyleEdit window hangs it, 100%cpu useage — at Version 14

Reported by: kutspam@… Owned by: jackburton
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version:
Keywords: Cc: diver, Niels.Reedijk@…, boolaiku@…
Blocked By: Blocking:
Platform: All

Description (last modified by axeld)

Drag a zip file onto StyledEdit window and it will hang and 100% cpu time is being used.

Change History (16)

comment:1 by diver, 18 years ago

Cc: diver added

comment:2 by jackburton, 18 years ago

Also opening ppm files hangs StyledEdit.

comment:3 by boolaiku@…, 18 years ago

attachments.isobsolete: 01

by boolaiku@…, 18 years ago

Attachment: StyledEditFileChecker.diff added

checks the mime type before loading a file

by boolaiku@…, 18 years ago

check the type of the file

comment:4 by axeld, 18 years ago

Owner: changed from sikosis to axeld

comment:5 by axeld, 18 years ago

Status: newassigned

comment:6 by boolaiku@…, 18 years ago

Cc: boolaiku@… added

comment:7 by Niels.Reedijk@…, 18 years ago

Hi Alexandre,

Since no one has responded to your patch, I've taken the liberty of looking at it. And I have some suggestions/questions.

  1. You define "char fileTypeStr[256];". The maximum length of the MIME-type is

defined in StorageDefs.h as "#define B_MIME_TYPE_LENGTH (B_ATTR_NAME_LENGTH - 15)", so I think you should use that one instead of 256.

  1. The title of your alerts "StyledEdit Load Failed" sounds rather spartan and

harsh. I haven't checked the other alert titles, so please check if this is a convention that's common (I'd opt for 'Load Failed', or better, 'Failed loading bla.png").

  1. What happens to files that don't have a MIME-type yet (like files just

checked out from SVN)? I'm not sure on standard procedure, but does the OS set the mimetype automatically? Please test this by dragging over an unmimetyped file. If your load fails, you might want to try to work 'update_mime_info' from Mime.h into your patch (perhaps extra if your mimetype is invalid - but I don't know if empty mime types are invalid).

Anyway, the code looks clean and good. Please have a look at the remaining issues, and then I'll check in the patch for you.

comment:8 by Niels.Reedijk@…, 18 years ago

Cc: Niels.Reedijk@… added

comment:9 by axeld, 18 years ago

I didn't accidently assigned this bug to me (it's not new, it's assigned). I've also spoken to Alexandre via IRC already; please don't check in that code, as it's not the correct solution to the problem.

comment:10 by boolaiku@…, 18 years ago

(In reply to comment #4) Thanks for looking at my proposal and for your remarks. I just made a new patch following suggestions 1 and 3. Not 2 because anyway the title is not shown on BAlert's. Anyway, i didn't post it. I'll rather wait for new directions from Axel since it

seems i touched a problem that goes deeper than i thought 8)

(In reply to comment #5) In fact it seems we're not yet ready for a fully typed os. What if the file has no mime type?, like on a fat32 partition. I'm sure we'll have solution for this

post R1. I'm supposing Axel prefers going more oldschool and do some other kind

of checking for StyledEdit. Please enlighten me :)

ps:What the best place for this kind of talk? mailing list? seems better

thanks both, going to bed...

comment:11 by Niels.Reedijk@…, 18 years ago

(In reply to comment #5)

I've also spoken to Alexandre via IRC already; please don't check in that code, as it's not the correct solution to the problem.

I didn't see any comments and I assumed this was a bug with a patch at which no one looked. That would be a waste. If you've got things under control, I'll take my hands of it.

OT:

I didn't accidently assigned this bug to me (it's not new, it's assigned).

Yeah, I noticed that. I also noticed that nowhere in the comments there was a reference to when you actually ASSIGNED it to you. My experience with other Bugzillas are that you were to eager in thinking you could fix it and assigned it too soon.

So please document that convention somewhere, as there are other projects that use different ones.

comment:12 by axeld, 18 years ago

When a back has been assigned and accepted (ie. it's status is not new anymore), a developer has indeed accepted to look at it. If that's the case, you could of course still ask to take it over, but you at least can assume that the developer in question looked into it. In fact, I wanted to have solved this issue already, but I got distracted, and didn't find the time to complete that yet. So thanks for the reminder, anyway :-)

comment:13 by diver, 18 years ago

Also if you go to /boot/beos/etc, select all and press enter (repeat again if needed) StyledEdit will eat 100% cpu.

comment:14 by axeld, 18 years ago

Component: ApplicationsUser Interface/InterfaceKit
Description: modified (diff)
Owner: changed from axeld to jackburton
Platform: All
Status: assignednew

I don't know if the last comment has anything to do with this bug, but the future will tell :-) I've investigated the issue, and prepared a fix in STXTTranslator such that it will only accept actual text documents. However, the actual problem lies in BTextView; it is called with a buffer full of invalid characters, and falls into an infinite loop as the result. Stefano, if that helps you, the BTextView::Insert() method is called from BTranslationUtils::GetStyledText() line 423.

Note: See TracTickets for help on using tickets.