IRC Log Viewer » #firebreath » 2010-12-13

IRC Nick Time (GMT-7) Message
taxilian 07:12 morning all!
jshanab 07:12 morning
taxilian 07:12 how's things coming?
_neilg_: you around?
jshanab 07:12 Zero progress, crash on destruction do to some kind of double delete.
taxilian 07:12 no luck tracking it down as a double shared_ptr?
jshanab 07:12 I have gone back to a regular pointer, embedded it int he class and back to shared_ptr. Still no luck
I need valgrind
taxilian 07:12 you change it all to a regular pointer so there are no shared_ptrs and it still does a double destruct?
jshanab 07:12 but i would need to port to linux first :-(
Yeah, it is in the firebreath calling boost::bind at that point. I figured it was me not respecting the plugin lifecycle, so I added some guards, but still has me baffeled
taxilian 07:12 wait… you're using boost::bind on that class? are you by chance passing in a raw pointer to boost::bind instead of the shared_ptr?
jshanab 07:12 A bit of a weird arch. It worked so i didn't wanna restructure it all
let me look
thread_.swap(boost::thread(boost::bind(ThreadFunc, boost::shared_ptr<CPlayer>(this))));
taxilian 07:12 there is your probelm
right there
jshanab 07:12 this is in the start function of the player
taxilian 07:12 you should *never never never* do anything like boost::shared_ptr<CPlayer>(this)
anywhere you are even using the this pointer is dangerous
but if you're putting it in a shared_ptr, that'll kill you
jshanab 07:12 Do i need to inherit form the boos_get_this ptr sas shared?
taxilian 07:12 inherit from boost::enable_shared_from_this<CPlayer)
inherit from boost::enable_shared_from_this<CPlayer>
and then remember that you can't do this from the constructor or destructor
but you can then use shared_from_this() to get a shared_ptr
jshanab 07:12 I have been reading a bit on it, but it is like mud to me
taxilian 07:12 do you have skype by chance?
jshanab 07:12 not yet, could install
taxilian 07:12 if you'd like, we could do a quick skype voicechat and I can run you through how it works
that would help you identify other potential issues like that
jshanab 07:12 In a room with 4 others, and no headset. Just moved into this room, not yet set up
taxilian 07:12 ahh
well, I'll do the best I can here, then
when you put something in a shared_ptr, it creates a data structure to hold the reference count
when that reference count hits zero, it frees it
standard, right?
but if you pass in just the ptr to the class (such as this, or another raw CPlayer*), it doesn't know where that data structure is
so it makes a new one
jshanab 07:12 right, (I hve written shared_ptr classes before, but am having trouble finding good boost doc on when it inc and decs)
taxilian 07:12 now there are two reference counts
so when the first hits 0, it frees the class
jshanab 07:12 but only 1 object!
taxilian 07:12 right; and when the second hits 0, it tries to release it again
and program go boom
jshanab 07:12 Exactly!
taxilian 07:12 so the way enable_shared_from_this works
is that it creates a weak_ptr in your class that has a reference to that data structure, but doesn't increment the reference count on the shared_ptr
jshanab 07:12 OK, my problem is that inside this class is the older C-style threadfunction that gets satarted by an api call
ah, snaeky
taxilian 07:12 there is a use_count and a weak_count, so the refcount structure doesn't go away 'til the weak_ptr refcount hits zero, but if the use_count is zero then it knows that the shared_ptr has been freed
the problem is that the weak_ptr isn't initialized until after it's been assigned once to a boost::shared_ptr
which means you can't use shared_from_this() from the constructor, because the weak_ptr isn't there yet
_neilg_ 07:12 Morning!
taxilian: Fantastic news about multiple MIME types inside one plugin!
taxilian 07:12 _neilg_: yeah; now I need help testing it
and, btw, the cmake magic involved is slightly frightening
kalev 07:12 yeah, multiple mimetype support sounds awesome, I'll give it a try in a few days. When are you planning to release 1.4?
jshanab 07:12 taxilian. Ok, that will work well with my arch
taxilian 07:12 kalev: probably at the end of the month; was hoping you could help me do some quick testing on linux, but if you can't for a few days I'll get by
_neilg_ 07:12 Just the phrase "CMake magic" breaks me into a cold sweat... lol
taxilian 07:12 jshanab: great
_neilg_: that's because you haven't seen the code I wrote Saturday… if you had, you would do more than sweat :-P
I wrote a function that works like configure_file, except it allows foreach blocks inside the template :-P
_neilg_ 07:12 What the..? Um... wow? lol
taxilian 07:12 it currently discards empty lines as an unfortunate side effect
but that's not currently a big deal, so I didn't waste time figuring out how to fix it
_neilg_ 07:12 Sure, I don't blame you for that
taxilian 07:12 _neilg_: so are you going to be able to help me test it? I've tested so far only on windows but it seems to work
_neilg_ 07:12 I'll be able to help you test it for sure but unfortunately I may not be able to get to it until the end of the week. I just got the core systems of our game engine working on the Mac last Friday which means it's time to bring others on-board - so I'll be busy getting others up to speed.
But as soon as I get a spare moment I'll definitely do that since I'd much prefer the one DLL. It doesn't really make a difference except to my coder OCD. lol
taxilian 07:12 *sigh*. you need to get your priorities straight, my friend… you act like getting the project done is more important than getting an awesome feature of FireBreath up and going… :-P ;-)
_neilg_ one DLL will also be significantly smaller on the install
_neilg_ 07:12 That's also true, the bootstrapping is a pretty big slice of each DLL
taxilian 07:12 when you consider the fact that the only firebreath code that is repeated for each plugin (in a multi-mime type in one DLL scenario) is the activeX control… that's a lot less than the entire FireBreath and crt =]
_neilg_ 07:12 That's also a good point! I'll get onto it ASAP, I just know that starting very soon today I'm going to be very busy... lol
I'm really pleased you got that working though. Good job!
taxilian 07:12 the real breakthrough was when I realized that I could make the main activex control a template with the CLSID and mimetype as template parameters
then I just register each CLSID/Mimetype (in generated code) and I have everything I need
the trick is figuring out if I caught everything and it will work on linux and mac as well
will try mac now
need to verify that before I can put it in trunk
_neilg_ 07:12 Sure. I suspect it will though, the NPAPI registration allows for multiple MIME types. But I can't say I've tested it on anything other than Windows so who knows?
taxilian 07:12 it does, but the syntax is slightly different on each platform
so I just need to make sure I got it right
without cmake, this would be impossible to make simple for the firebreath user
Sinisa 07:12 hi all
taxilian 07:12 hey, Sinisa
Sinisa 07:12 yo tax, how's things?
jshanab 07:12 taxilian. That fixed it! thanks. Now would you be able to point me in the direction to begin looking fro why video playback used to but now does not work in chrome or safari, but works fine in FF and IE (all on windblows)
taxilian 07:12 Sinisa: the capabilities check as far as supported event models / drawing models should be built-in to firebreath and there is a matrix of which support what on the wiki
jshanab: I don't know any reason that would be… the only difference I know is that chrome and safari are out of process
Sinisa 07:12 I've looked into documentation, but I haven't found how do I check if (for instance) Cocoa CA can be used
I've found listing of which browser support which event/draw modes
but not how do I know which event/draw mode is currently available
jshanab 07:12 taxilia. thanks. It worked before and the rest of the API works. I will do some tracing
taxilian 07:12 Sinisa: it just depends on which PluginWindow you get
whichever you get, that's what's available
Sinisa: amackera will probably be in a little later (in a few hours?) and you can ask him for more details
Sinisa 07:12 ok, so if I cast PluginWindow into CocoaCA window, and that is not supported (eg. it's firefox 3.6), how do I know that?
ok
thanks
will wait for the master :-P
i know in npp there is a function getvalue which can be used to get if certain event/draw mode are available
but npp is now wrapped in FB
so i don't know how to do it through FB's window
since basically I can cast FB window into any window
taxilian 07:12 http://www.firebreath.org/display/documentation/class FB PluginEventSource validType
http://www.firebreath.org/display/documentation/class+FB+PluginEventSource+validType
win->validType<PluginWindowWin>() will return true if that is a PluginWindowWin
or you could use win->get_as<PluginWindowWin>() and check to see if it's null
those are both just helper functions to do a dynamic_cast, btw
Sinisa 07:12 Taxilian: I've checked a bit header of PluginEventSource.h, and appears that FB has bad-cast-detection and will return NULL if cannot cast into desired type
oh I just saw your reply
taxilian 07:12 =]
Sinisa 07:12 ok, so basically, if cannot be casted, it will set it to NULL
that's how I know?
taxilian 07:12 or you can use validType which does that check for you and returns a bool
Sinisa 07:12 ok let me try
jshanab 07:12 taxilian. here is something interesting. The fire events in the api work fine and can be traced, but the play method never makes it thru to the pluginAPI.cpp code
taxilian 07:12 check to make sure you registered it correctly
and that you're passing in the correct types (is it throwing a JS exception?)
jshanab 07:12 Same registration as is used on FF and IE, maybe Play is a reserved (HTML5) javascript method? LOL
taxilian 07:12 hmm. I guess that's possible, but does seem strange
jshanab 07:12 Is there a console for executing javascript? like in FF?
taxilian 07:12 firebug
it's an extension
there is also jash, which works on all browsers as a bookmarket
jshanab 07:12 Ah, play calls start, Problem is Still between keyboard and chair
Sinisa 07:12 @taxilina: do I understand this correctly, i call: win->get_as<FB::PluginWindowMacCocoaCA>() and if returns NULL, it means current browser is not supporting Cocoa CA?
_neilg_ 07:12 There's also Firebug Lite which is also a bookmarklet
Sinisa 07:12 ok found a way
that get_as() will return non-NULL for Cocoa CA even if I run Firefox 3.6 - which is obviously not good.
but I can cast first into CocoaCA
test if it's NULL
and if not, then test valid...() if returns true or false
taxilian 08:12 CA isn't supported on firefox 3.6 AFAIK
Sinisa 08:12 that way works
it recognizes that Firefox3.6 has no Cocoa CA support
taxilian 08:12 Sinisa: win->validType<FB::PluginWindowMacCocoaCA>() will return true if the window is a FB::PluginWindowMacCocoaCA and false if not
Sinisa 08:12 of course it's not supported - that's what I'm saying - that there's maybe a bug that in get_as<>()
taxilian 08:12 it just does the cast and returns false if the cast returns NULL
Sinisa 08:12 because get_as returned non-NULL
under Firefox3.6
taxilian 08:12 hmm; that wouldn't be a bug in get_as
get_as is just a dynamic_cast
there could be a bug in the detection code, though
Sinisa 08:12 unless i misunderstood get_as
taxilian 08:12 which is NpapiPluginMac.cpp
you can go look at it
or wait for amackera
Sinisa 08:12 win->get_as<FB::PluginWindowMacCocoaCA>() <- this should return NULL if running under Firefox3.6, am I right?
taxilian 08:12 I would expect so, yes
unless the browser is claiming to support Cocoa and CoreAnimation
Sinisa 08:12 did not in my case - can you verify in some test project on your end?
in FF3.6 on my mac, it returned non-NULL value
taxilian 08:12 sure can't; I don't have a test project that does any drawing
that's why amackera does it =]
Sinisa 08:12 you won't need to draw anything
just test if under FF3.6 get_as will return NULL or not
taxilian 08:12 I can try, but it'll be in a few hours
Sinisa 08:12 however, validType(...) is returning correct (false)
taxilian 08:12 what??
that doesn't make any sense at all
validType just returns true if get_as returns non-null
it's the same call
Sinisa 08:12 ok let me paste you my codes
taxilian 08:12 are you sure you don't have a typo somewhere?
Sinisa 08:12 just a sec
taxilian 08:12 use pastebin
or fpaste
or whatever
Sinisa 08:12 http://fpaste.org/6Mjw/
taxilian 08:12 Sinisa: google c++ dynamic cast and learn what it is
in the mean time, there is a big difference between FB::PluginWindowMacCocoaCA *testCast = (FB::PluginWindowMacCocoaCA*)pwin; and FB::PluginWindowMacCocoaCA *testCast = dynamic_cast<FB::PluginWindowMacCocoaCA*>(pwin);
or FB::PluginWindowMacCocoaCA *testCast = pwin->get_as<FB::PluginWindowMacCocoaCA*>(); which does the same thing as a dyanmic_cast
if you just typecast it like that it will always be non-null
unless your start pointer was non-null
was null, I mean
Sinisa 08:12 pwin->get_as<FB::PluginWindowMacCocoaCA*>() was returning non-null
that's why I asked you about it
taxilian 08:12 then send me a code snippet where you are calling that
'cause in the code snippet you sent me, you were doing FB::PluginWindowMacCocoaCA *testCast = (FB::PluginWindowMacCocoaCA*)pwin;
and that won't work
trust me on this one. 100% of hte time, if validType returns false, get_as will return NULL
as long as the type specified in the template parameter is the same, anyway
https://github.com/firebreath/FireBreath/blob/master/src/PluginCore/PluginEventSource.h#L104
Sinisa 08:12 it will have bad cast if cast is unsupported or not from inherited class, but it will perform cast
ok let me copy you coe
code
taxilian 08:12 https://github.com/firebreath/FireBreath/blob/master/src/PluginCore/PluginEventSource.h#L104
do you understand how dynamic_cast<TYPE> works?
Sinisa 08:12 http://fpaste.org/1F8D/
jshanab 08:12 taxilian. Interesting note should probably go on wiki: Param names in html are case sensitive in safari and chrome but not IE and Firefox . Working in all 4 browsers now
taxilian 08:12 ok, I'm not sure what you're doing; I'm really confused. however, don't *ever* do this: FB::PluginWindowMacCocoaCA *testCast = (FB::PluginWindowMacCocoaCA*)pwin;
jshanab: you're right, it should go on the wiki. feel free to put it there =]
Sinisa: also, why are you using a void* into that function?
Sinisa 08:12 yes, I understand casting as well as inheritance - I couldn't do all the work without it
taxilian 08:12 I didn't ask if you understand casting
I ask if you understand how dynamic_cast works
because you aren't using it correctly
you should *never* do this: (FB::PluginWindowMacCocoaCA*)pwin;
that's C
and that's only if you know that it's that type
Sinisa 08:12 yes, it's typedown-safe cast
taxilian 08:12 right; so in the first function what you're doing isn't safe
you don't need to do testCast->validType
do w->validType
Sinisa 08:12 ok, what about second function?
taxilian 08:12 the second funciton, aside from using a void* which still confuses me, looks fine
so fix the first function and tell me if it still returns different from the second function
Sinisa 08:12 first function is fine
second is not
taxilian 08:12 first function is most definitely not fine
not even a little bit
and it won't be accurate
Sinisa 08:12 first function returns correct false/true for browsers and their support for Cocoa CA
taxilian 08:12 no, it doesn't
Sinisa 08:12 second returns true even for ff3.6
dude, It is
I am seeing it
with my own eyes
taxilian 08:12 dude, if you ask me for advice, please listen to the advice I give you. Please fix the first function and tell me if it starts returning true as well
use this: bool OSX_PFF_SupportsCocoaCA( void *w ) { FB::PluginWindow *pwin = (FB::PluginWindow*)w; return w->validType<FB::PluginWindowMacCocoaCA>(); }
I know it sounds like I'm being obstinate, but I wrote that code and I promise I have a reason for asking
Sinisa 08:12 http://fpaste.org/oI1y/ like this?
ah ok
i don't know why sometimes this chat is not auto-scrolling, so i don't see your comment immediately
taxilian 08:12 validType isn't intended to be called on the class after typecasting
you should call it on the object *before* you typecast
Sinisa 08:12 oh ok
and what about get_as ?
taxilian 08:12 same
all they do is dynamic_cast to the specified type
it's just a shorthand
for convenience
you could do a dynamic_cast and it works exactly the same way
so the function you sent me (that you added to the bottom) should be fine
Sinisa 08:12 http://fpaste.org/n0JO/
taxilian 08:12 if you have actually built that and it does as you claim (and keep in mind that get_as will throw an exception if it's not a valid cast, not just return NULL) then you have successfully proved that 0 = 1
or something really really strange is going on
https://github.com/firebreath/FireBreath/blob/master/src/PluginCore/PluginEventSource.h#L104
please look at the source code to get_as and validType
Sinisa 08:12 so, is get_as returning NULL or I need to check for throw?
taxilian 08:12 because I can't for the life of me understand how that could be possible
you have to put it in a try … catch, looks like
I probably told you wrong
however, it still wouldn't return true
it would throw an exception
so should be noticable
sorry, wouldn't return NULL
Sinisa 08:12 if you have time, just make new project, and try these 2 functions as-is, in windowattached event
taxilian 08:12 I have
Sinisa 08:12 try ff3.6 and ff4.0
taxilian 08:12 though not with that particular browser
I don't have ff4.0
Sinisa, there is something wrong in your code
Sinisa 08:12 i am on mac
taxilian 08:12 if those two functions are not returning the same
Sinisa 08:12 not sure if that makes any difference
taxilian 08:12 well, it does
Sinisa 08:12 than using hackintosh
or something emulated
taxilian 08:12 oh, I see what you're saying
no, that shouldn't matter
the question is whether or not that is actually a valid cast
Sinisa 08:12 u're also on 'real' macosx?
taxilian 08:12 yes
Sinisa 08:12 on your machine it returns always correct?
taxilian 08:12 I don't know; I haven't tested
I don't use drawing on any of my plugins
but here is the thing: it negotiates with the browser to decide what is supported
so either your cast isn't working correctly (for whatever reason) or the browser things it supports that model
that's why I wanted to figure out which is correct
Sinisa 08:12 ok let me show you source
taxilian 08:12 you need to find out what type of object that is
jshanab 08:12 taxilian. I was trying to figure out where best to put that info in the wiki and the wiki went haywire. Getting html include errors on connection when searching for PARAMS
taxilian 08:12 hmm. I'm not having a problem
jshanab: it might need to go on a new page; not sure if there is a good place yet
Sinisa 08:12 http://fpaste.org/4wjf/
jshanab 08:12 ok, must be the long distance conection. Well i think it has more to do with m_paramsSet
taxilian 08:12 you can't edit that in the wiki
Sinisa 08:12 o sorry
taxilian 08:12 the classdocs
Sinisa 08:12 let me paste again
jshanab 08:12 I was gonna try to just adda comment here http://www.firebreath.org/display/documentation/class%20FB%20PluginCore%20m_supportedParamSet#aa27001bcc194d42d1d01d5490489f406
but the page is erroring out at this end
taxilian 08:12 that should work; let me see if I can pull it up
nope, I can't
hang on
try now
somehow the web server went haywire
jshanab 08:12 It's Back!
Sinisa 08:12 ok here it is: http://fpaste.org/zsbL/
ff3.6 now crashes on this line
taxilian 08:12 Sinisa: you may be fixing this already, but get_as will throw an exception if it's not a valid cast, so you either need a try block, do your own dynamic_cast, or use validType
that's why it crashes; unhandled exception
the question is more why it didn't crash before?
Sinisa 08:12 oh ok, so get_as is not safe without try-catch?
taxilian 08:12 I apologize, though; I probably told you wrong. I thought it was returning the dynamic_cast, but it throws an exception
correct
Sinisa 08:12 it did
taxilian 08:12 okay =]
all is right in the universe again
Sinisa 08:12 just i thought it crashes because plugin tries to initialize CAOpenGLLayer on null CALayer
taxilian 08:12 most likely it crashed because of an unhandled exception
Sinisa 08:12 ok, maybe would be good to add this tip into documentation - how to correctly determine event/draw model on Mac
unless it's there and I've missed it
taxilian 08:12 that would be a great idea; would you mind doing it? =]
Sinisa 08:12 no, just how?
taxilian 08:12 just sign into the wiki
and edit the page
it's all editable by users
you'll have to create an account
Sinisa 08:12 @tax, done, under tips & tricks
is that ok?
taxilian 08:12 Sinisa: that'll work, at least for now
Mac Plugins would also be a good place
but since I don't have time to mess with it right now, I'll take whatever you decide =]
this is where most mac info is: http://www.firebreath.org/display/documentation/Mac+Plugins
Sinisa 08:12 when I try to edit Mac Plugins, click save, I get some java errors... will try later again
taxilian 08:12 weird… wonder whats up with the server today :-/
Sinisa 08:12 there's only one problem left, that I gotta solve
taxilian 08:12 cool =]
sorry if I'm a little short-tempered today, btw; I'm just very tired
Sinisa 08:12 Chrome for some reason is not calling draw in CAOpenGLLayer
no prob
Safari does
all works fine
but Chrome never enters into draw
taxilian 08:12 what version of mac os? 10.6?
Sinisa 08:12 and I call explicitly setNeedsDisplay
yes
10.6.5
taxilian 09:12 hmm
dunno
amackera question =]
Sinisa 09:12 he must be reading all this and is thinking: "I am not removing away status"
taxilian 09:12 lol
actually, he uses ZNC just like I do, so if he's connected it automatically removes the away status
'course, he could be reading the logs :-P I do that sometimes when I'm not sure I have time to sign in
Sinisa 09:12 i've found that other ppl had similar issues
but haven't seen any explanation
basically, layer is there, i've tested it's frame, size is valid, but never gets into draw
not sure if i need to do something with received CALayer first
taxilian 09:12 hmm… this is Chrome? I wonder if it's using InvalidatingCoreAnimation...
I think that's CocoaICA instead of CocoaCA
Sinisa 09:12 oh
taxilian 09:12 but it probably extends CocoaCA
so the cast would success
succeed
Sinisa 09:12 ok, let me see
just to check, for ICA, can I still use same Cocoa class based on CAOpenGLLayer?
or there's something else for ICA?
taxilian 09:12 I think so; I'm not sure exactly what the differences are
Sinisa 09:12 ok trying now
let u know a bit later
kalev 09:12 taxilian: hey, I just gave a quick try to multiple mime types in Linux and everything seems to work as advertised
one thing I'd like to note is that people are probably going to want different FBSTRING_FileDescription for each of the mime type
taxilian 09:12 kalev: awesome… 'cause it doesn't on Mac. :-P
kalev 09:12 :P
taxilian 09:12 kalev: *sigh*. I can manage that...
just trying to decide what the easiest way to do all of this in PluginConfig.cmake is
FB_GitHubBot 09:12 FireBreath: multimime Kalev Lember * b90bad8 (1 files in 1 dirs): NpapiPlugin: Initialize base class before member variables ... - http://bit.ly/fvLAX2
kalev 09:12 taxilian: if you want to take a look how to do (hardcoded) multiple mime types on Mac, take a look at http://code.google.com/p/esteid/source/browse/esteid-browser-plugin/trunk/Mac/bundle_template/Info.plist
taxilian 09:12 unfortunately, that's only half of it
I have that part working
I have to update the Localized.r as well
the problme is that cmake is somehow discarding my |
kalev 09:12 Hmpf, we don't have any | in the Localized.r file: http://code.google.com/p/esteid/source/browse/esteid-browser-plugin/trunk/Mac/bundle_template/Localized.r
taxilian 09:12 ooh
you're right
I was wrong =]
and very glad I was
this is much easier
kalev 09:12 great :)
taxilian 09:12 wish I knew why this was doing what it's doing, but since it works on windows (the other place I needed it...)
but my crazy configure_template function will make this easy
kalev 09:12 hehe
taxilian 09:12 I forgot you guys were doing this as well
so you're probably quite glad that I finally got around to this =]
fewer hacks required
kalev 09:12 certainly :)
jshanab 09:12 ok, I have an msi that works. Is there a smooth way to trigger an install? Is it suppose to work with the CODEBASE property?
taxilian 09:12 nope
to both questions
basically most people create a javascript library to detect if the plugin is there or not
kalev 09:12 wow, I am so excited that I can finally create different API classes for each of the MIME types
taxilian 09:12 =]
kalev 09:12 but this has to wait a few days, need to work on something else now.
thanks taxilian!
taxilian 09:12 thanks for testing it on linux for me
think I've just about got it working on mac as well
then I think I will push it to master and let the bug reports roll in… :-P
kalev 09:12 sure
taxilian 09:12 this is weird; firefox still shows the two mimetypes on the same line, seperated by a ;
kalev 09:12 then you must have ; in one of the files in bundle_template
taxilian 09:12 well, the ; could come from the mimetype variable which is now a list
cmake stores lists as a string seperated by ;
(which is really annoying sometimes)
but I *changed* that, and it's still there
will try again...
build from scratch
I'm actually pretty excited about this feature; it's probably the most majorly useful feature to be added in quite some time
ahh, just had to regenerate
works now
kalev 09:12 yay
taxilian 09:12 hmm.. except it did crash just a little bit in firefox...
… and on safari when it quit
kalev 09:12 might be an unrelated crash; there isn't really that much of new C++ code
taxilian 09:12 you wouldn't think so, but it is consistent
0 ??? 0x0000000500020000 0 + 21474967552
1 ...BTestPluginLib.FBTestPlugin 0x000000011565ecf7 FB::Npapi::NpapiBrowserHost::ReleaseObject(NPObject*) + 45
2 ...BTestPluginLib.FBTestPlugin 0x0000000115652b7f FB::Npapi::NPObjectAPI::releaseObject(NPObject*) + 113
3 ...BTestPluginLib.FBTestPlugin 0x00000001156546b7 boost::_mfi::mf1<void, FB::Npapi::NPObjectAPI,
weird
ooh...
it's a side effect of two plugins releasing the same object at the same time
very interesting
and very strange
it's that reference count bug with releasing the NPObjects form the browser
kalev 09:12 oh, do you load two instances of the same plugin on the same web page?
taxilian 09:12 yeah
well
sorta
I load two instances each with its own mimetype
but the same plugin dll
in this case, though, it's the same plugin still
kalev 09:12 yeah, I figured as much
taxilian 09:12 crap crap crap. WHY DOES THIS EVEN HAPPEN?
this is really frustrating
kalev 09:12 we must be doing something wrong because otherwise everybody else would have already hit the same issue
taxilian 09:12 that's what I'd think… but I can't find anything that could possibly cause this
kalev 09:12 or are they just leaking memory? :)
taxilian 09:12 it'd almost have to be a heap corruption issue
the only place that we even *call* Release and Retain is in this one place
and it's not like there is much room for this to go wrong...
that's possible
I'm just going to have to leave a memory leak in there… I hate this
I wonder if leaks will detect it...
ahh, no, because it's the province of safari
hmm
well, don't know what else to do
firefox is even worse...
kalev 10:12 I just tried to reproduce it on Linux: modified FBTestPlugin's test.html to load two different objects with different mime types
unfortunately it's not crashing for me
ooh, looks like Valgrind has a new tool called 'ptrcheck' which is able to check for overruns in stack based arrays (that's something 'memcheck' tool wasn't able to do)
taxilian 10:12 awesome
wish I could get valgrind to work on my mac
I'm starting to think I may just have to stop retaining the NPObjects and keep them in the DOM instead
rather in an object on the Window
actually, in firefox it's something else… no idea what or where
but when I try to get a backtrace after the issue, there is nothing there
which implies the stack is toast
kalev 10:12 I just ran the test plugin in Firefox under valgrind's memcheck and it didn't complain about anything relevant
taxilian 10:12 good to know...
(I've been wanting that done for awhile)
Jamil 10:12 Question please
taxilian 10:12 what kind of question would you like?
Jamil 10:12 is it possible to use MFC into firebreath project?
taxilian 10:12 it should be, yes
you'll just have to figure out how to modify your project in cmake so that you have the MFC libs and such
Jamil 10:12 any example like FBTestPlugin
taxilian 10:12 nope; I hate MFC, and thus don't use it =]
you're welcome to make one, though =]
the hard part is just figuring out how to get the MFC libs and includes into the project
Sinisa 10:12 yo
amackera is still away?
taxilian 10:12 Jamil: my guess is that the headers will just work, so all you'll likely need to do is build it and find out which libs you don't have, then add them
Jamil 10:12 I have a project built with MFC and need to use firebreath to make one like it
Sinisa 10:12 i've added ICA, and added invalidate window call in timer, but still no luck with seeing anything in Chrome & FFox4
taxilian 10:12 Sinisa: if his nick is still _away, he is still away
Jamil 10:12 Pls help with these errors
FireBreathWin.def : warning LNK4022: cannot find unique match for symbol 'DllCanUnloadNow'
taxilian 10:12 meaning not connected; it's the way his client works
Jamil: you probably have two versions of that function
Sinisa 10:12 @tax my statement was sound of desperation :-)))
taxilian 10:12 =]
Jamil 10:12 1>FireBreathWin.def : warning LNK4002: [email protected] defined in C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\lib\uafxcwd.lib
FireBreathWin.def : error LNK2001: unresolved external symbol DllCanUnloadNow 1>FireBreathWin.def : error LNK2001: unresolved external symbol DllGetClassObject
taxilian 10:12 Jamil: That will be a problem; MFC is trying to implement it as well, but you have to use firebreath's. there might be a way to disable the MFC version of CanUnloadNow
Sinisa 10:12 @Jamil you need to ignore some libraries
Jamil 10:12 how?
Sinisa 10:12 first list all libs that have duplicated symbols
then in proj settings, you have in linker, list of libs you want it to ignore
although, it may cause some other issues
Jamil 10:12 how to know the libs with duplicated symbols
Sinisa 10:12 since you wanna use mfc, then i guess u gotta ignore non-mfc libs, but then FB may be missing something from those
it says: uafxcwd.lib is one
taxilian 10:12 uafxcwd is actually an MFC lib more than an ATL one
Sinisa 10:12 some of standard libs also have this DllCanUnloadNow symbol defined
Jamil 10:12 I did for uafxcwd
taxilian 10:12 but you can't use the DllCanUnloadNow from that because you must use FireBreath's
Jamil 10:12 how I ignore DllCanUnloadNow
Sinisa 10:12 ignore that uafxcwd.lib
Jamil 10:12 done
Sinisa 10:12 i am not sure u can ignore just a symbol from a lib
Jamil 10:12 but still have DllCanUnloadNow warnings/error
Sinisa 10:12 welcome to MFC port :D
why do you need mfc for?
if you make plugin based on mfc, it's windows-only
Jamil 10:12 I have project using MFC types like CLIST, CPen, POSITION etc...
Sinisa 10:12 if it's for some gui or whatever, maybe better try STL or wxwidgets or qt
if it's only because of these - then less pain is to change these into non-mfc-types
Jamil 10:12 I agree
but write like CPEN
taxilian 10:12 MFC just doesn't play nice with other libraries very well; it might be possible to somehow add *just* the types you need, but I don't know. there is too much "magic" in MFC to make figuring that out easy
my understanding was that you could add MFC to an ATL control project
but I don't know any details
I just remember reading that somewhere
Jamil 10:12 Cpen from AFXWIN.H...how to write the same
back to MFC any help for this error
stdafx.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
jshanab 10:12 Is there an api callback in the FireBreath Framework that can hook into where the browser throws up the little bar about a plugin missing
taxilian 10:12 jshanab: no, because if the plugin is missing, then firebreath can't very well be called, now can it? =]
jshanab 10:12 duh, Jshanab needs more kofee
taxilian 10:12 jshanab: http://logs.firebreath.org/%23firebreath_20101207.log there was a lot of discussion on installers and detection on this day
jshanab 10:12 thanks
taxilian 10:12 sorry it's not more readable :-/ one of these days one of us will need to write a log parser to make the logs easier to use
also that info needs to be distilled and put on the wiki somewhere
FB_GitHubBot 10:12 FireBreath: multimime Richard Bateman * 622fc94 (6 files in 4 dirs): Multiple mimetype now supported on Mac
FireBreath: multimime Richard Bateman * 255613f (1 files in 1 dirs): Fixed typo in log message
FireBreath: multimime commits b90bad8...255613f - http://bit.ly/foGZYC
Jamil 10:12 Is there any email support to help us during our integration with MFC?
taxilian 10:12 from FireBreath, you mean?
Jamil 10:12 yes
taxilian 10:12 there might be a Microsoft list somewhere that you could find help at, but definitely not from FireBreath. To the best of my knowledge, you're the first to even try
with MFC, I mean
there are other drawing libraries that you could try, other than MFC; I just don't know enough about MFC to be able to help much wtih that
and 90% of the support on the firebreath list is me
Jamil 10:12 ok clear...I will try to not use MFC as you all suggest
taxilian 10:12 sorry, I wish I could give you a more helpful answer ;-/
Jamil 10:12 thx..going now
taxilian 10:12 good luck
taxilian 11:12 so we definitely have a hit-and-miss crash on Firefox on Mac still
anyone know how to resolve symbols from a mozilla crash report?
http://crash-stats.mozilla.com/report/index/bp-84075431-9710-4874-ba3d-064d62101213.
http://crash-stats.mozilla.com/report/index/bp-84075431-9710-4874-ba3d-064d62101213
taxilian 11:12 n/m, turns out I needed to disable the crash reporter to get anythign intelligent out of it
taxilian 13:12 and the mac bug is fixed!
hurray for fixing bugs that have been in the codebase for awhile
surprised nobody caught that one… but it doesn't show up much except with multple plugins running at the same time
_neilg_ 13:12 Huh, weird! Even I wouldn't have caught that one, I remove the object tags for old plugins before adding new ones.
neilg_ 13:12 Good fix to have though!
taxilian 13:12 so there was an issue with concurrency
really strange
had to add some mutexes, change to a threadsafe queue
I should have read cygmatics "quick unfinished patch' before I applied it
he warned me it might not be done… :-P
neilg_ 13:12 Whoops! Ah well, these things happen. At least it's caught and fixed now - and that's the main thing!
taxilian 13:12 I think, however, that this means that multi-mime type should be good to go; I'll do a little more testing and push it to master
yep
neilg_ 13:12 That's awesome
taxilian 13:12 I have created a linkedin group for FireBreath users; good additional place for networking, I also hope that people will use it when looking for someone to build a plugin for them. http://www.linkedin.com/groups?mostPopular=&gid=3716370
taxilian 13:12 kalev: I'll just have to disable reference counting of NPObjects in Safari; I don't know what else to do
other than a really elaborate hack, which I will do if it becomes neccesary
involving saving things in the JS Window object for future access :-P
FB_GitHubBot 14:12 FireBreath: multimime Richard Bateman * 09c5bfa (6 files in 3 dirs): Fixed thread-safety issue in OneShotManager (mac async events) ... - http://bit.ly/gImH0h
FireBreath: master Richard Bateman * 949d09a (9 files in 3 dirs): Initial proof of concept for multiple mimetype support on IE, non-functional
FireBreath: master Richard Bateman * c7d2a8c (27 files in 10 dirs): Working prototype of FireBreath supporting multiple plugins in one DLL / library on all browsers
FireBreath: master Kalev Lember * b90bad8 (1 files in 1 dirs): NpapiPlugin: Initialize base class before member variables ...
FireBreath: master Richard Bateman * 622fc94 (6 files in 4 dirs): Multiple mimetype now supported on Mac
FireBreath: master Richard Bateman * 255613f (1 files in 1 dirs): Fixed typo in log message
FireBreath: master Richard Bateman * 09c5bfa (6 files in 3 dirs): Fixed thread-safety issue in OneShotManager (mac async events) ...
FireBreath: master commits abf518b...09c5bfa - http://bit.ly/hE05gC
taxilian 14:12 ok; everyone using dev, whether you are using multiple mimetypes or not, please update and make sure I haven't broken anything of yours ASAP
so that I can fix it; today is the day I have the most time
jshanab 14:12 What is the ActiveX plugin name?
taxilian 14:12 huh?
jshanab 14:12 I am in javascript and trying to determine if the plugin is installed. there is a '
activeX plugin name" i need to use
taxilian 14:12 to use the ActiveXObject method?
jshanab 14:12 yes
taxilian 14:12 in your PluginConfig.cmake file
ACTIVEX_PROGID
jshanab 14:12 Thanks!
taxilian 14:12 the nice UPS man just delivered a book called ATL Internals Second Edition (Working with ATL 8)
neilg_ 14:12 If only ATL was nice... lol
taxilian 14:12 lol. however, there isn't really a compelling reason to ditch it anymore, since you can now build firebreath using free compilers and still use ATL
thus my hope is that this will help explain some of the things that I can't find docs for anywhere
it actually has a chapter on ActiveX Controls
this is the most documentation I've ever found on the subject
anywhere
taxilian 14:12 be back… running to get lunch
kalev 14:12 taxilian: what version of Safari are you testing with?
bon appetit.
taxilian 14:12 kalev: the latest; 5.something on 10.6
kalev 15:12 taxilian: if we fail to call ReleaseObject when reference count is 1, is the browser going to leak memory?
taxilian: for example, is this going to leak badly? http://fpaste.org/aNgH/
doesn't the browser clean up after himself anyway when it's shutting down the plugin?
jshanab 15:12 So, i have a browser plugin in 4 browsers and an aceptable install, but IE fightts me on allowing content. I need to "get it to be Authorized". Is that the same as signing and does FB have a neat way to do that?
taxilian 15:12 kalev: yeah, so it's not a "permanent" leak
kalev: believe it or not, I actually tried something similar to what you're suggesting… not sure why, but it didn't work
still crashed
jshanab: I think there is info on how theoretically should work on the wiki...
jshanab 15:12 thanks
taxilian 15:12 here: http://www.firebreath.org/display/[email protected]/Potential+Installer+Improvements?focusedCommentId=2162999#comment-2162999
jshanab 15:12 I tried that per-project.WXS the other day, must of made an error
taxilian 15:12 per-project?
jshanab 16:12 taxilian. I have a little trouble understanding that page. especially "I have defined ${FBSTRING_CLSID} as a property (and have declared set(FBControl_GUID ${FBSTRING_CLSID})) in PluginConfig.cmake." Where would a property go?
taxilian 16:12 those are settings in PluginConfig.cmake
variables
jshanab 16:12 ok
so "defined" and "declared" are both just the set command
?
taxilian 16:12 the way he's using it, it just means set
kalev 16:12 taxilian: hey, I've been testing reference counting back and forth and I can no longer get any NPAPI hosts I've tested with in Linux to crash with my patch
do you think you could give it a try with Safari?
I've pushed it to [email protected]:kalev/FireBreath.git , so you could just pull from there to test it
taxilian 16:12 certainly
give me a few
have I mentioned lately how much I like git? I just add a remote and pull the changes to a new branch =]
kalev 16:12 yes, it's really awesome :)
taxilian 16:12 you realize that > 0 just means != 0, since referenceCount is a uint32?
crashed almost immediately
the thing is, if referenceCount is 0, then the object has been freed
so who *knows* what it will be
it could be anything
because the memory could have (likely will have) been reused
kalev 16:12 so if we are in NPObjectAPI destructor, are you saying that the object might have already been freed?
taxilian 16:12 the way that releaseObject works is when the refcount hits 0, it frees the object
so something, somewhere is changing the referenceCount
it stands to reason that it's somewhere in some code (in the browser?) that is calling release when it shouldn't
the thing is, there simply isn't anywhere else that we are calling release, so it's kinda hard to imagine that we could be doing it
but yeah, it's either that or something is clobbering the memory
so it's a question of which it is
what really baffles me is that it happens on multiple browsers
kalev 16:12 Okay, so we are in our destructor and referenceCount == 1. We call releaseObject, which makes referenceCount == 0 and we finish destructing our object. When we return after destructing our object, NPAPI host sees that referenceCount is 0, destroys whatever data it needs to destroy at browser side and calls our releaseObject to finish our objects destruction (but the object is already destructed), which results in a crash.
am I getting it all wrong or is something like that possible?
taxilian 16:12 no; it's not a question of "after we return..."
NPAPI destroys it *when the count hits 0*
so when we call releaseObject, when that call returns the object is destructed
assuming refcount was 1
that's why we use CallOnMainThread to release the object; the retain and release are not threadsafe. so if you're on the main thread already, CallOnMainThread just runs the function and returns. If not, it marshals it to the main thread and waits for it to finish
kalev 16:12 could it be that the browser doesn't check reference counts when it's shutting down the plugin and just destroys everything it can to avoid leaks?
taxilian 16:12 hmm. the crash only seems to happen when we start up or shutdown a plugin...
have we ever seen that crash during the plugin lifecycle? I don't think I have...
kalev 16:12 nope, it's always at shutdown
taxilian 16:12 you may have something there
because the API could potentially get destroyed very late in the process...
we could probably make it not release NPObjects just when the plugin is shutting down… that might be worth a try
jshanab 16:12 When we put the htm test page in the top level folder, is there a way for it to show in the solution instead of the gen file one?
taxilian 16:12 let me tinker for a minute
jshanab: not sure I understand the question
kalev 16:12 so maybe using our own reference counted pointers to manage life time isn't a good approach here: maybe we should call delete in releaseObject manually when the reference count is right
jshanab 16:12 To "override
to "override" the generated htm page, I was instucted to move a copy to the plugin directory
taxilian 16:12 kalev: I'm not sure how we could change it; we can't delete before the object goes away
jshanab 16:12 But when I am in Visual Studio, it shows there and i can edit it, but it is editing the gen file.
taxilian 16:12 jshanab: yeah; that's intentional. the reason is that you can then use variables from PluginConfig (such as the mimetype) in that file
and it will get generated into build/projects/<plugin>/gen/
jshanab 16:12 ah
no the one that is editable in the soulution is the one in the gen folder
taxilian 16:12 ahh
how did you get that in your solution?
that's impressive
jshanab 16:12 it was already there :-)
taxilian 16:12 really? on windows?
jshanab 16:12 lemme look, maybe I put it in the CMAKE
taxilian 16:12 wait
no
oh, wait...
I see
the one that is there is the one in gen_templates/
hmm
yeah, didn't think of that
jshanab 16:12 it is the $GEN_DIR}/gen/*.htm in the CMake fiel
taxilian 16:12 yeah; because it's grabbing all the generated files
jshanab 16:12 that is the only htm file. so there should be a way to say dir A if not Dir B
taxilian 16:12 hmm. I will have to think about it for awhile; it's unfortunately harder than it sounds :-(
I really need to rework how the generated files work
kalev 16:12 taxilian: ooh, I found a really interesting ticket in mozilla bugzilla
https://bugzilla.mozilla.org/show_bug.cgi?id=421217#c75
taxilian 16:12 hmm. I think this has to do with a plugin's deallocate code, though, not the browsers
jshanab 16:12 taxilian. I got it
http://pastebin.com/WDCPEepA
taxilian 16:12 jshanab: what file is that in?
jshanab 16:12 the Top level CMakeLists.txt
taxilian 16:12 of your plugin?
jshanab 16:12 as in the one in my plugin directory
taxilian 16:12 hmm. okay
that works, then
I'll see if I can't give you a better solution soonish, but it'll do what you need it to for now
hmm. wait…
huh. well, I'll have to look at it later
jshanab 16:12 No problem, just a thought. I dunno everything else is files you edit, maybe fbgen place those files in the dir and the build copies to gen. Kinda a double play
taxilian 16:12 I'll just have the code that generates the files put the source files it uses in a list
that you can use
jshanab 16:12 oops, that didn't work :-( Oh well. my bad
taxilian 16:12 kalev: crash gone; hang on and I'll push you something to try
FB_GitHubBot 17:12 FireBreath: master Kalev Lember * b71d812 (1 files in 1 dirs): NpapiPlugin: Avoid calling releaseObject when reference count is <= 0 ...
FireBreath: master Richard Bateman * f665837 (9 files in 4 dirs): Fixed crash on safari caused by bad reference counts (when things got released after the browser cleaned up for the plugin)
FireBreath: master commits 09c5bfa...f665837 - http://bit.ly/gEjMoq
taxilian 17:12 kalev: it's on master, see if you can still reproduce your crash on linux
and if you can't, my friend, then you are a genius
I never would have considered that
and this has given me a really really good idea...
bordering on brilliant
hmm
more to follow =]
but not right now; I have a final to take. I'll be back in a few hours
kalev 17:12 this is awesome, I can't get it to crash
allright, but now I need to go to bed
night!
taxilian 19:12 well, this has been a very productive day… I can't believe we finally fixed that crash! (knock on wood)
taxilian 21:12 ooh… net split